vue-resource icon indicating copy to clipboard operation
vue-resource copied to clipboard

I need to change 'Content-type' for request. How can I do it?

Open vashchenkov opened this issue 7 years ago • 3 comments

I need to set content-type to 'application/json-rpc' but I can't do it. I try this code:

let headers = {
  headers: {
    'Content-Type': 'application/json-rpc'
  }
}
return Promise.resolve()
  .then(function () {
    return http.post(self.baseUrl, requestObj, headers).then()
  })

but request is still have

Content-Type:application/json;charset=UTF-8 I can set right 'Content-Type' in global scope

Vue.http.headers.post['Content-Type'] = 'application/json-rpc' But it's not good.

Is it possible to set content type in specific request?

vashchenkov avatar Jan 29 '18 11:01 vashchenkov

Try this: return http.post(self.baseUrl, requestObj, {options: headers}).then()

OskarD avatar Feb 13 '18 18:02 OskarD

I tried this.$http.post(bbvaRateUrl, form, {headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}}).then( ... ) but no luck

Meekohi avatar Mar 19 '18 16:03 Meekohi

I am having the same issue. @steffans, would you be able to answer this, or someone else I can ping?

robaxelsen avatar Mar 12 '19 14:03 robaxelsen