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

Grpc-Message header is not percent decoded #425

Closed
evanj opened this issue Jan 1, 2019 · 1 comment
Closed

Grpc-Message header is not percent decoded #425

evanj opened this issue Jan 1, 2019 · 1 comment

Comments

@evanj
Copy link

evanj commented Jan 1, 2019

The gRPC specification states "Status-Message is [...] physically encoded as UTF-8 followed by percent-encoding." However, the gRPC-Web client does not percent decode the error detail. The official NodeJS gRPC client does.

Example response payload:

HTTP/1.0 200 OK
Content-Type: application/grpc-web-text
Content-Length: 0
Grpc-Status: 11
Grpc-Message: emoji error: %F0%9F%98%80

The gRPC-Web client decodes this into an error object with details of 'emoji error: %F0%9F%98%80'. The NodeJS client decodes it into 'emoji error: \u{0001F600}' ('emoji error: 😀')

A brief inspection of the code seems to suggest this needs to be done if the header comes from either the trailers or the XHR response:

message: self.xhr_.getResponseHeader(GRPC_STATUS_MESSAGE)

@evanj evanj changed the title Error Status-Message is not percent decoded Grpc-Message header is not percent decoded Jan 1, 2019
@stanley-cheung
Copy link
Collaborator

This should be fixed by #858 in release 1.2.0. Added some decodeURIComponent call in the relevant places.

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