Open lopezchr opened 7 years ago
Hello @lopezchr could you please add the error you get ?
I will take a look
The request send an application/json content-type. Now, if I change the content type manually...
return trae.post(url, formData, {
headers: {
Authorization: `Bearer ${token}`
'Content-Type': 'multipart/form-data'
}
})
I had this in my php api.
Missing boundary in multipart/form-data POST data in Unknown on line 0
try this!
return trae.post(url, formData, {
headers: {
Authorization: `Bearer ${token}`
'Content-Type': ''
}
})
did this work ?, i am having a similar problem, only that the trae library does not give me any error but the server does not receive any multipart-form-data
I got the same problem. In the docs: // The Headers object associated with the request headers: { 'Content-Type': 'application/json' // Default header for methods with body (patch, post & put) 'X-My-Custom-Header': 'foo-bar' },
I tried override Content-Type: ' '
but doesn't work! I have this response:
It seems like still sending with header Content-Type: 'application/json'
I was watching this method:
_initMethodsWithBody() {
const defaultConf = {
headers: { 'Content-Type': 'application/json' },
}
;['post', 'put', 'patch'].forEach((method) => {
this._config.set({ [method]: defaultConf })
this[method] = (path, body = {}, config = {}) => {
const url = formatUrl(this._baseUrl, path, config.params)
const mergedConfig = this._config.merge(config, { body, method, url })
return this._fetch(url, mergedConfig)
}
})
}
I just change:
const defaultConf = { headers: { 'Content-Type': 'application/json' }, }
By this:
const defaultConf = { headers: {}, }
And works because is passing headers: empty by default now.
Tengo el mismo problema, no puedo subir imagenes, alguna solucion?
@viciotec looks like @clochi's is right, I will work on it as soon as I can.
@viciotec parece que @clochi 's tiene razón, trabajaré en ello tan pronto como pueda.
Ah pasado mucho tiempo y sigue sin solucion
@cmoralesheras eres bienvenido a colaborar en la librería, nosotros lo hacemos en nuestro tiempo libre
En el momento empezamos a trabajar en la v2 y nos gustaría resolver en issue ahí
I've tryed to use this library to send a multipart form data. I'm using vuejs and javascript FormData but it does not work. I've using axios semantic like this: https://scotch.io/tutorials/how-to-handle-file-uploads-in-vue-2
How can I solve this?