Gert Cuykens
Gert Cuykens

Reputation: 7155

How to get the response headers from gapi.client endpoints

How can I get the response headers from

gapi.client.myEndpoint.myRpc().execute(function(response){console.log('Need the response headers')})

Upvotes: 1

Views: 584

Answers (1)

Nick
Nick

Reputation: 3591

You can't inspect response headers in this manner. Endpoints API system doesn't even supply a way for you to modify or set the headers. Header inspection/modification is something you should do in a normal handler.

At best, I can give this advice. If you use the function gapi.client.request() method, you can hit the REST endpoints for your API, and this function returns a gapi.client.Request object. Calling .execute() on this object will allow you to pass a callback function which will receive the response, including headers.

Upvotes: 3

Related Questions