fix: handle upper case protocol like HTTP or HTTPS by FDrag0n · Pull Request #1805 · koajs/koa (original) (raw)
#1800 's fix #1804 forgot to consider the case where url is uppercase HTTP and HTTPS
fix pull 1804 when url like HTTP or HTTPS
fix pull 1804 when url like HTTP or HTTPS
Codecov Report
All modified and coverable lines are covered by tests ✅
Project coverage is 98.66%. Comparing base (435534a) to head (7f35d51).
Additional details and impacted files
@@ Coverage Diff @@ ## master #1805 +/- ##
Coverage 98.66% 98.66%
Files 5 5
Lines 525 525
Branches 147 147
Hits 518 518
Misses 7 7
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
@fengmk2 I realized we forgot to deal with Case conversion of http in #1804 fix !
fengmk2 changed the title
fix pull 1804 when url like HTTP or HTTPS fix: support upper case protocol like HTTP or HTTPS
fengmk2 changed the title
fix: support upper case protocol like HTTP or HTTPS fix: handle upper case protocol like HTTP or HTTPS
| // location | |
|---|---|
| if (url === 'back') url = this.ctx.get('Referrer') | | alt |
| if (url.startsWith('https://') | | url.startsWith('http://')) { |
| if (/^https?:\/\//i.test(url)) { |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FDrag0n I change to use Regex to avoid lowerCase twice.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a nice change👍
fengmk2 added a commit that referenced this pull request
Co-authored-by: fengmk2 suqian.yf@antgroup.com
fengmk2 added a commit that referenced this pull request
pick from #1805
Co-authored-by: FDrag0n 34733637+FDrag0n@users.noreply.github.com
etroynov pushed a commit to etroynov/koa that referenced this pull request
Co-authored-by: fengmk2 suqian.yf@antgroup.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})