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

docs: update specific for auto response status #1493

Merged
merged 1 commit into from
Jul 27, 2020

Conversation

AlbertAZ1992
Copy link
Contributor

fix: #1464

@codecov
Copy link

codecov bot commented Jul 26, 2020

Codecov Report

Merging #1493 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1493   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          487       487           
  Branches       136       136           
=========================================
  Hits           487       487           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2224cd9...6292f8c. Read the comment docs.

- `null` no content response
- `null` || `undfined` no content response

If `response.status` has not been set, Koa will automatically set the status to `200` or `204` depending on `response.body`. Specifically, if `response.body` has not been set or has been set as `null` || `undfined`, which means no content response, Koa will automatically set `response.status` to `204`. If you really want to send no content response with other status, you should override the `204` status as the following way:
Copy link
Member

Choose a reason for hiding this comment

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

undfined misspelled.

Copy link
Member

Choose a reason for hiding this comment

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

I would remove which means no content response, the reason to why null or undefined it set is ambiguous to Koa - but it interprets it as 204 No Content as you wrote.

Copy link
Member

@miwnwski miwnwski Jul 26, 2020

Choose a reason for hiding this comment

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

NIT: I would not use ||'s for documentation text, rather use explicit or. However, as it's how it's defined in the list above I wouldn't mind keeping it if its clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. That was updated. I also thought about or against || as definition listed above. Now i change to use or for documentation text.

@miwnwski miwnwski merged commit 38cb591 into koajs:master Jul 27, 2020
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.

Response code auto set to 204 after being previously set to 200 with undefined or null body.
3 participants