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

Add ability to add middleware. #4

Merged
merged 5 commits into from
Mar 8, 2016
Merged

Conversation

mogetutu
Copy link
Contributor

@mogetutu mogetutu commented Mar 7, 2016

Updated

  • AbstractRequest

#2

mogetutu and others added 3 commits March 7, 2016 23:15
Signed-off-by: Bram Devries <bram@madewithlove.be>
Signed-off-by: Bram Devries <bram@madewithlove.be>
@bramdevries
Copy link
Member

Tests were failing because of babel/babel-eslint#267

@@ -43,12 +48,17 @@ export default class AbstractRequest {

// Parse promise if need be
let promise = fetch(endpoint, requestOptions);

if (requestOptions.method === 'DELETE') {
promise = promise.then(::this.checkStatus);
} else {
promise = promise.then(::this.parseJSON);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work. The response our middleware receives would already be a parsed response, instead of the direct result of fetch

Signed-off-by: Bram Devries <bram@madewithlove.be>
Signed-off-by: Bram Devries <bram@madewithlove.be>
bramdevries added a commit that referenced this pull request Mar 8, 2016
@bramdevries bramdevries merged commit a328fd6 into master Mar 8, 2016
@bramdevries bramdevries deleted the feature/middlewares branch March 8, 2016 07:48
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

Successfully merging this pull request may close these issues.

2 participants