Skip to content
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

Payload from HttpNode changed in 0.20 when posting a FormData #2122

Closed
5 tasks done
marcioluis opened this issue Apr 1, 2019 · 1 comment
Closed
5 tasks done

Payload from HttpNode changed in 0.20 when posting a FormData #2122

marcioluis opened this issue Apr 1, 2019 · 1 comment

Comments

@marcioluis
Copy link

marcioluis commented Apr 1, 2019

What are the steps to reproduce?

I have a Angular app that POST a manually build FormData to a HttpNode in NodeRed with a file as Base64 encoded. Something like this.

uploadImaged(dadosImaged: UploadImaged): Observable<HttpEvent<Imaged>> {
    const url = `${environment.NODE_RED_URL}/uploadImaged`;
    let body = new FormData();
    body.set('codTipoDoc', `${dadosImaged.codTipoDoc}`);
    body.set('descricao', dadosImaged.descricao);
    body.set('file', dadosImaged.file);
    body.set('filename', dadosImaged.filename);
    body.set('indices', JSON.stringify(dadosImaged.indices));
    const req = new HttpRequest('POST', url, body, { reportProgress: true });
    return this.http.request<any>(req).pipe(catchError(this.errorHandler));
}

What happens?

Until version 0.19.X the PAYLOAD of HttpNode was show as a buffer or a raw string in debug node.
In version 0.20.X when POSTing to HttpNode an exception is raised. TypeError: invalid media type.
Activating the flag Accept file uploads? the payload is parsed but I need the buffer version to make an HttpRequest to another backend.

Example:
Evidence Image/imgur

What do you expect to happen?

Payload should be a buffer formdata like in version 0.19

Please tell us about your environment:

  • Node-RED version:
    0.20.X
  • node.js version:
    8.15.1
  • npm version:
    6.4.1
  • Platform/OS:
    Linux Mint
  • Browser:
    Any
@knolleary
Copy link
Member

Fixed in master - will be in 0.20.4 this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants