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

fix(http): correctly handle response body for 204 status code #12830

Closed
wants to merge 2 commits into from

Conversation

DzmitryShylovich
Copy link
Contributor

Fixes #12393

@@ -239,7 +239,7 @@ export declare class XHRConnection implements Connection {
request: Request;
response: Observable<Response>;
constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions);
setDetectedContentType(req: any, _xhr: any): void;
Copy link
Contributor

Choose a reason for hiding this comment

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

please refrain from changing the types - add a // TODO: ... in the code (and open a meta issue "[3.0] Adding/fixing types" referencing the place where we should update). Thanks !

@@ -5,15 +5,13 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

could you please leave a blank line here

@vicb vicb added comp: http action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 12, 2016
@@ -137,7 +148,7 @@ export class XHRConnection implements Connection {
});
}

setDetectedContentType(req: any /** TODO #9100 */, _xhr: XMLHttpRequest) {
setDetectedContentType(req: any /** TODO #9100 */, _xhr: any /** TODO #9100 */) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why ?

async.done();
});

existingXHRs[0].setStatusCode(statusCode);
Copy link
Contributor

Choose a reason for hiding this comment

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

would this have failed before ?
should you add an explicit body ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

thx

// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
let status: number = _xhr.status === 1223 ? 204 : _xhr.status;

let body: any = null;

// 204 is not supposed to have any response body
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: change to // HTTP 204 means no content

@vicb vicb added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews pr_state: LGTM labels Nov 12, 2016
@vicb vicb added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 13, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception is thrown for 204 HTTP response
3 participants