本文介绍了在javascript中使用正文和标题发布请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我的帖子请求
hi i have post request
function GetTokenfromGrap(resource, obj, failureCallback) { debugger; var deffered = $q.defer(); resource = '/xxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, } $http.post(url, obj, configurations).then(deffered.resolve).catch(function (data) { handleCatch(data); if (typeof failureCallback === 'function') failureCallback(data); }); return deffered.promise; }i想要为此添加身体请求,我该怎么办 我尝试过: i googled它但我没有得到任何解决方案
i want to add body to this request , how can i do this What I have tried: i googled it but i didn't get any solution
推荐答案q.defer(); resource ='/ xxxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers:{'Content-Type':'application / x-www-form-urlencoded'},} q.defer(); resource = '/xxxxx/oauth2/token' var url = baseUrl + resource; var configurations = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, }
http.post(url,obj,configurations).then(deffered.resolve).catch(function(data){ handleCatch(data); if(typeof failureCallback ===' function')failureCallback(data); }); return deffered.promise; } http.post(url, obj, configurations).then(deffered.resolve).catch(function (data) { handleCatch(data); if (typeof failureCallback === 'function') failureCallback(data); }); return deffered.promise; }
i想要为此添加身体请求,我该怎么办 我尝试过: i搜索它但我没有得到任何解决方案
i want to add body to this request , how can i do this What I have tried: i googled it but i didn't get any solution
obj是正文。
更多推荐
在javascript中使用正文和标题发布请求
发布评论