-
Notifications
You must be signed in to change notification settings - Fork 14
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
multipart form data? #69
Comments
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.
|
try this!
|
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 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. |
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?
The text was updated successfully, but these errors were encountered: