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

[Question]How to get response header with 'PromiseClient'? #904

Closed
kybetter opened this issue Jul 17, 2020 · 2 comments
Closed

[Question]How to get response header with 'PromiseClient'? #904

kybetter opened this issue Jul 17, 2020 · 2 comments

Comments

@kybetter
Copy link

e.g:

import { FooPromiseClient } from './SearchService_grpc_web_pb';

const fooService = new FooPromiseClient('http://xxx.xxx');

fooService.foo(someRequest).then(response => {
  // I can only get response body here, How can I get response header, please help me.
})
@stanley-cheung
Copy link
Collaborator

You will need to write an Interceptor to get access to the metadata. See the blog post: https://grpc.io/blog/grpc-web-interceptor/#unary-interceptor-example

@kybetter
Copy link
Author

You will need to write an Interceptor to get access to the metadata. See the blog post: https://grpc.io/blog/grpc-web-interceptor/#unary-interceptor-example

Thank you! But Where do I get 'UnaryInterceptor' interface? I don't know how to get it.

Should I download it from here? https://github.com/grpc/grpc-web/blob/master/javascript/net/grpc/web/interceptor.js

borissmidt pushed a commit to borissmidt/grpc-web that referenced this issue Feb 16, 2022
borissmidt pushed a commit to borissmidt/grpc-web that referenced this issue Feb 16, 2022
* Fix CI exit code reporting
* Simplify local integration test usage
* Fixed webpack compatibility with old browsers (safari 9)
* Upgrade karma
* Disabled websocket tests for old versions of firefox
* Removed firefox 21 due to SSL incompatibility
* Updated latest browser versions
* Revert "added websocket transport to cancel propagation test (grpc#904)"
borissmidt pushed a commit to borissmidt/grpc-web that referenced this issue Feb 16, 2022
* Continue reading websocket to handle closing

* added websocket transport to cancel propagation test (grpc#904)

(cherry picked from commit 36be481)

* Added cancellation test

Co-authored-by: Wiktor Jurkiewicz <[email protected]>
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