Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

wadl-client does not expose response headers #12

Open
christopherdcunha opened this issue Jan 12, 2017 · 0 comments
Open

wadl-client does not expose response headers #12

christopherdcunha opened this issue Jan 12, 2017 · 0 comments

Comments

@christopherdcunha
Copy link

Currently, the callback in:

...
    client.item.post()
      .withHeaders(headers)
      .send(JSON.stringify(body))
      .onValue(callback);
...

will only receive the response body from the backend (

wadl-client/wadl-client.js

Lines 142 to 160 in 04c2de0

xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
try {
if(xhr.status >= 200 && xhr.status < 300) {
Utils.send(sink, options.parse ? Utils.parseBody(xhr) : xhr.responseText);
}
else if(xhr.status === 0 || xhr.reason === "timeout") {
Utils.logError(options.logger, xhr.responseText);
Utils.send(sink, new B.Error({code: "ETIMEDOUT"}));
}
else {
Utils.send(sink, new B.Error(options.parse ? Utils.parseBody(xhr) : xhr.responseText));
}
} catch(e) {
Utils.logError(options.logger, "An error occured while parsing: " + xhr.responseText);
Utils.send(sink, new B.Error(e));
}
}
};
)

My use-case requires me to get the response headers. I can update the abovementioned code to return xhr object directly but this would not be backwards compatible. Any thoughts?

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

No branches or pull requests

1 participant