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

File upload response status check and response parsing to JSON. #722

Closed
saurabh1e opened this issue Jun 30, 2017 · 2 comments
Closed

File upload response status check and response parsing to JSON. #722

saurabh1e opened this issue Jun 30, 2017 · 2 comments
Labels
Milestone

Comments

@saurabh1e
Copy link
Contributor

Bug Report

File: covalent/core/file/services/file.service.js

xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200 || xhr.status === 201) {
                        subscriber.next(JSON.parse(xhr.response));
                        subscriber.complete();
                    }
                    else {
                        subscriber.error(xhr.response);
                    }
                }
            };
  1. Status should be checked for >= 200 and < 300.
  2. Response should be returned with out parsing in JSON.

What is the expected behavior?

xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status >= 200 && xhr.status < 300) {
                        subscriber.next(xhr.response);
                        subscriber.complete();
                    }
                    else {
                        subscriber.error(xhr.response);
                    }
                }
            };

What is the motivation / use case for changing the behavior?

I am trying to upload file to AWS S3 which is returning 204 and response in XML. This will fix the issue.

@emoralesb05
Copy link
Contributor

Can you open a small PR with this fix please? 😄

@saurabh1e
Copy link
Contributor Author

Sure! I will do that.

@saurabh1e saurabh1e mentioned this issue Jul 3, 2017
4 tasks
@emoralesb05 emoralesb05 added this to the Next Release milestone Jul 3, 2017
@emoralesb05 emoralesb05 added the bug label Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants