How is the URL build in got? Part 3 #1607
-
Describe the bug#1546 continue from
Actual behaviorhttp://somehost/?q=%B4%BA%BD%BA Expected behaviorhttp://somehost/?q=%B4%BA%BD%BA Code to reproduceconst got = require('got');
(async () => {
a = await got(
'https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=%B4%BA%BD%BA&oquery=%ED%95%9C%EA%B8%80+%EC%9D%B8%EC%BD%94%EB%94%A9&tqi=huRGOwprvhGssA7smnNssssstrs-353069'
);
})(); Checklist
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
source/core/index.ts:1453 if (this.options && this.options.skipDecodeURI === true) {
// if skipDecodeURI is set to true then do not decode it will avoid some decoding errors
} else {
decodeURI(this.requestUrl);
} const got = require('got');
(async () => {
a = await got(
'https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=%B4%BA%BD%BA&oquery=%ED%95%9C%EA%B8%80+%EC%9D%B8%EC%BD%94%EB%94%A9&tqi=huRGOwprvhGssA7smnNssssstrs-353069',
{ skipDecodeURI: true }
);
})(); that solves the problem. |
Beta Was this translation helpful? Give feedback.
-
What about the tests? Lines 38 to 45 in d0cd709 |
Beta Was this translation helpful? Give feedback.
-
Got is just an HTTP client, the answer is in the specification, you should look there instead unless you find something against the spec. |
Beta Was this translation helpful? Give feedback.
-
hmmm I understand the spec but this problem is more for the language specific. when korean language is encoded it will encode the say above for word "news" this prevents for me to request through got. can you remove the spec check? if URL is wrong then that is up to the dev. if anything for validation it should have a separate lib or function. |
Beta Was this translation helpful? Give feedback.
-
They way you encode it is wrong. I just checked and it's possible to encode it properly.
No. Got is a spec-compliant client. |
Beta Was this translation helpful? Give feedback.
What about the tests?
got/test/arguments.ts
Lines 38 to 45 in d0cd709
https://url.spec.whatwg.org/#percent-encoded-bytes