How to POST content as application/x-www-form-urlencoded2019 Community Moderator ElectionHow do I POST urlencoded form data with $http without jQuery?How to make POST requests with the FormData APIHow to get JSON back from HTTP POST Request (to another domain)How can I post data as form data instead of a request payload?How do I POST urlencoded form data with $http without jQuery?AngularJS $http.put not working in Firefox or Chrome. Works ok in IESyntaxError: Unexpected token # while displaying text fileHow to set header to the $http.post method AngularJS 1.3.5?Set content-type header to json for request.postAccessing API with $http POST Content-Type application/x-www-form-urlencodedHow to use AngularJS $http to send multipart/form-dataHow to generate a swagger file for the header “Content-Type: application/x-www-form-urlencoded” in Informatica cloud?
Is there a logarithm base for which the logarithm becomes an identity function?
If sound is a longitudinal wave, why can we hear it if our ears aren't aligned with the propagation direction?
Why aren't there more Gauls like Obelix?
Professor forcing me to attend a conference, I can't afford even with 50% funding
When an outsider describes family relationships, which point of view are they using?
The preposition for the verb (avenge) - avenge sb/sth (on OR from) sb
Why do phishing e-mails use faked e-mail addresses instead of the real one?
If nine coins are tossed, what is the probability that the number of heads is even?
Idiom for feeling after taking risk and someone else being rewarded
Use Mercury as quenching liquid for swords?
(Codewars) Linked Lists-Sorted Insert
How do we create new idioms and use them in a novel?
Having the player face themselves after the mid-game
Are all players supposed to be able to see each others' character sheets?
Is divide-by-zero a security vulnerability?
Create chunks from an array
How do you make a gun that shoots melee weapons and/or swords?
Logistic regression BIC: what's the right N?
What is better: yes / no radio, or simple checkbox?
Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?
Trocar background-image com delay via jQuery
Under what conditions can the right to be silence be revoked in the USA?
Short scifi story where reproductive organs are converted to produce "materials", pregnant protagonist is "found fit" to be a mother
What does the Digital Threat scope actually do?
How to POST content as application/x-www-form-urlencoded
2019 Community Moderator ElectionHow do I POST urlencoded form data with $http without jQuery?How to make POST requests with the FormData APIHow to get JSON back from HTTP POST Request (to another domain)How can I post data as form data instead of a request payload?How do I POST urlencoded form data with $http without jQuery?AngularJS $http.put not working in Firefox or Chrome. Works ok in IESyntaxError: Unexpected token # while displaying text fileHow to set header to the $http.post method AngularJS 1.3.5?Set content-type header to json for request.postAccessing API with $http POST Content-Type application/x-www-form-urlencodedHow to use AngularJS $http to send multipart/form-dataHow to generate a swagger file for the header “Content-Type: application/x-www-form-urlencoded” in Informatica cloud?
angularjs $http.post is refusing to use my Content-Type
I am working with a contractor - their team are making server-side APIs while I'm putting together a javascript application using angularjs. They insist on making the api only allow calls with application/x-www-form-urlencoded calls, so I'm trying to figure out how to use $http to make a urlencoded call, and running into problems. All the instruction pages I'm finding seem focused on older versions of angularjs.
I try using the below code:
$scope.makeApiCall = function( )
var apiData =
"key1" : "value1",
"key2" : "value2"
;
var apiConfig =
"headers" :
"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8;"
;
return $http.post('/Plugins/apiCall', apiData, apiConfig)
.then(function(response)
$scope.data=response.data;
);
;
But when I make the call, instead of using the Content-Type I provided, the developer tools report that it uses Content-Type: text/html; charset=utf-8
How do I get my $http.post to send the right Content-Type?
angularjs api angularjs-http
add a comment |
angularjs $http.post is refusing to use my Content-Type
I am working with a contractor - their team are making server-side APIs while I'm putting together a javascript application using angularjs. They insist on making the api only allow calls with application/x-www-form-urlencoded calls, so I'm trying to figure out how to use $http to make a urlencoded call, and running into problems. All the instruction pages I'm finding seem focused on older versions of angularjs.
I try using the below code:
$scope.makeApiCall = function( )
var apiData =
"key1" : "value1",
"key2" : "value2"
;
var apiConfig =
"headers" :
"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8;"
;
return $http.post('/Plugins/apiCall', apiData, apiConfig)
.then(function(response)
$scope.data=response.data;
);
;
But when I make the call, instead of using the Content-Type I provided, the developer tools report that it uses Content-Type: text/html; charset=utf-8
How do I get my $http.post to send the right Content-Type?
angularjs api angularjs-http
add a comment |
angularjs $http.post is refusing to use my Content-Type
I am working with a contractor - their team are making server-side APIs while I'm putting together a javascript application using angularjs. They insist on making the api only allow calls with application/x-www-form-urlencoded calls, so I'm trying to figure out how to use $http to make a urlencoded call, and running into problems. All the instruction pages I'm finding seem focused on older versions of angularjs.
I try using the below code:
$scope.makeApiCall = function( )
var apiData =
"key1" : "value1",
"key2" : "value2"
;
var apiConfig =
"headers" :
"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8;"
;
return $http.post('/Plugins/apiCall', apiData, apiConfig)
.then(function(response)
$scope.data=response.data;
);
;
But when I make the call, instead of using the Content-Type I provided, the developer tools report that it uses Content-Type: text/html; charset=utf-8
How do I get my $http.post to send the right Content-Type?
angularjs api angularjs-http
angularjs $http.post is refusing to use my Content-Type
I am working with a contractor - their team are making server-side APIs while I'm putting together a javascript application using angularjs. They insist on making the api only allow calls with application/x-www-form-urlencoded calls, so I'm trying to figure out how to use $http to make a urlencoded call, and running into problems. All the instruction pages I'm finding seem focused on older versions of angularjs.
I try using the below code:
$scope.makeApiCall = function( )
var apiData =
"key1" : "value1",
"key2" : "value2"
;
var apiConfig =
"headers" :
"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8;"
;
return $http.post('/Plugins/apiCall', apiData, apiConfig)
.then(function(response)
$scope.data=response.data;
);
;
But when I make the call, instead of using the Content-Type I provided, the developer tools report that it uses Content-Type: text/html; charset=utf-8
How do I get my $http.post to send the right Content-Type?
angularjs api angularjs-http
angularjs api angularjs-http
edited 2 days ago
georgeawg
33.9k105170
33.9k105170
asked Mar 6 at 21:24
Wolfman JoeWolfman Joe
6741720
6741720
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
How to POST content as application/x-www-form-urlencoded
Use the $httpParamSerializerJQLike service to transform the data:
.controller(function($http, $httpParamSerializerJQLike)
//...
$http(
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers:
'Content-Type': 'application/x-www-form-urlencoded'
);
);
For more information, see
- AngularJS $httpParamSerializerJQLike Service API Reference
- Stackoverflow -- URL-encoding variables using only AngularJS services
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032377%2fhow-to-post-content-as-application-x-www-form-urlencoded%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
How to POST content as application/x-www-form-urlencoded
Use the $httpParamSerializerJQLike service to transform the data:
.controller(function($http, $httpParamSerializerJQLike)
//...
$http(
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers:
'Content-Type': 'application/x-www-form-urlencoded'
);
);
For more information, see
- AngularJS $httpParamSerializerJQLike Service API Reference
- Stackoverflow -- URL-encoding variables using only AngularJS services
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
add a comment |
How to POST content as application/x-www-form-urlencoded
Use the $httpParamSerializerJQLike service to transform the data:
.controller(function($http, $httpParamSerializerJQLike)
//...
$http(
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers:
'Content-Type': 'application/x-www-form-urlencoded'
);
);
For more information, see
- AngularJS $httpParamSerializerJQLike Service API Reference
- Stackoverflow -- URL-encoding variables using only AngularJS services
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
add a comment |
How to POST content as application/x-www-form-urlencoded
Use the $httpParamSerializerJQLike service to transform the data:
.controller(function($http, $httpParamSerializerJQLike)
//...
$http(
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers:
'Content-Type': 'application/x-www-form-urlencoded'
);
);
For more information, see
- AngularJS $httpParamSerializerJQLike Service API Reference
- Stackoverflow -- URL-encoding variables using only AngularJS services
How to POST content as application/x-www-form-urlencoded
Use the $httpParamSerializerJQLike service to transform the data:
.controller(function($http, $httpParamSerializerJQLike)
//...
$http(
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers:
'Content-Type': 'application/x-www-form-urlencoded'
);
);
For more information, see
- AngularJS $httpParamSerializerJQLike Service API Reference
- Stackoverflow -- URL-encoding variables using only AngularJS services
edited yesterday
answered Mar 6 at 22:35
georgeawggeorgeawg
33.9k105170
33.9k105170
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
add a comment |
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
That does the trick, thank you. I was hunting for something like that for hours.
– Wolfman Joe
Mar 6 at 22:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032377%2fhow-to-post-content-as-application-x-www-form-urlencoded%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown