Skip to content

Added support for url-encoding the data in case the content-type is application/x-www-form-urlencoded #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

asranja
Copy link

@asranja asranja commented Nov 18, 2016

No description provided.

@@ -7,6 +7,7 @@ import http = require("http");
import https = require("https");
import tunnel = require("tunnel");
import ifm = require('./interfaces/common/VsoBaseInterfaces');
import querystring = require('querystring');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont see this module defined in the package.json

@@ -179,7 +180,14 @@ export class HttpClient implements ifm.IHttpClient {
var socket;

if (objs) {
reqData = JSON.stringify(objs, null, 2);
var urlEncFormContentType: boolean = options.headers["Content-Type"] && options.headers["Content-Type"].indexOf("application/x-www-form-urlencoded") != -1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than inspecting headers, has an alternative been considered where a flag can be passed-in that indicates "don't JSON stringify", and leave it up to the caller to pre-format the data as desired.

Copy link
Contributor

@bryanmacfarlane bryanmacfarlane Nov 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a moot point. It's changing to be a Buffer. It's up to the consumer to json'ify or not. This is an http client and it should not be biased toward JSON. However, the layer above it (rest client) will be.

@bryanmacfarlane
Copy link
Contributor

as noted above, moot point in new pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants