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

use the ability of content-type lib directly #1276

Merged
merged 1 commit into from Dec 7, 2018

Conversation

mingmingwon
Copy link
Contributor

As we can see the doc of content-type: https://github.com/jshttp/content-type#contenttypeparsereq, it can deal with the original req directly and will also throw TypeError exception when Content-Type is missing or invalid. So in my opinion, we don't need let type = this.get('Content-Type'); to get the type and if (!type) return '' to check if the type is unvalid.

As we can see the doc of `content-type`: [https://github.com/jshttp/content-type#contenttypeparsereq](https://github.com/jshttp/content-type#contenttypeparsereq), it can deal with the original `req` directly and will also throw the exception when `Content-Type` is missing or unvalid. So in my opinion, we don't need `let type = this.get('Content-Type');` to get the type and `if (!type) return ''` to check if the type is unvalid.
@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #1276 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1276   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files           5       5           
  Lines         395     393    -2     
======================================
- Hits          395     393    -2
Impacted Files Coverage Δ
lib/request.js 100% <100%> (ø) ⬆️

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 281a04e...dd27a08. Read the comment docs.

@dead-horse dead-horse merged commit 5560f72 into koajs:master Dec 7, 2018
kiku-jw pushed a commit to kiku-jw/koa that referenced this pull request Feb 26, 2019
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.

None yet

2 participants