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

avoid parser exception on 204 no content #96

Merged
merged 5 commits into from
Feb 5, 2021

Conversation

tsolakoua
Copy link
Member

@tsolakoua tsolakoua commented Jan 18, 2021

Fixes #95

@tsolakoua tsolakoua marked this pull request as ready for review January 18, 2021 12:00
@@ -121,6 +121,11 @@ private void parseData(HTTPClient client) {

// Tries to read the body.
private String readBody() {
// Workaround to avoid ParserException when status code is 204
if (statusCode == 204) {
body = "{ \"data\": { } } ";
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it mean you want the SDK to return a body "{ "data": { } } " when doing a delete?

@tsolakoua tsolakoua marked this pull request as draft January 28, 2021 16:32
@tsolakoua tsolakoua changed the title avoid parser exception on 204 no content avoid parser exception on 204 no content (work in progress) Jan 28, 2021
@tsolakoua tsolakoua changed the title avoid parser exception on 204 no content (work in progress) avoid parser exception on 204 no content Feb 1, 2021
@tsolakoua tsolakoua marked this pull request as ready for review February 1, 2021 12:00
Copy link
Contributor

@anthonyroux anthonyroux left a comment

Choose a reason for hiding this comment

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

Did it impact the unit-tests?

@@ -67,6 +66,9 @@ protected void parse(HTTPClient client) {
// Detects of any exceptions have occured and throws the appropriate exceptions.
protected void detectError(HTTPClient client) throws ResponseException {
ResponseException exception = null;
if (statusCode == 204) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be part of the if else if else if part instead of being an if isolated?

@@ -97,6 +99,9 @@ private void parseStatusCode() {

// Tries to parse the data
private void parseData(HTTPClient client) {
if (this.statusCode == 204) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having it here with an empty return could it be in the same file line 64 (in the parse method) with something like:

 protected void parse(HTTPClient client) {
    parseStatusCode();
    if(this.statusCode != 204) {
         parseData(client);
   }
  }

@anthonyroux anthonyroux self-requested a review February 5, 2021 09:44
@tsolakoua tsolakoua merged commit 3e7d425 into master Feb 5, 2021
@tsolakoua tsolakoua deleted the fix-parse-exception-204 branch February 5, 2021 12:11
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.

Fix unwanted exception on Delete Flight Order Management API
2 participants