Support the special character '.' in header names
See original GitHub issueBackground
HTTP header field names can contain the character .
according to this RFC and the definition of a token
within.
However, httpyac fails to properly parse an .http
file with such a header name.
Although commonly used header names have dashes, certain web services can require custom header names.
httpyac
should fully support the RFC, especially for proper interoperability with the IntelliJ REST Client plugin.
Example http File
GET https://google.com
header.name: xyz
Executing httpyac
with such a file, the following error report can be observed:
ExecuteHook: httpClient failed
RequestError: The `GET` method cannot be used with a body
at Request._destroy (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\core\index.js:1378:21)
at _destroy (node:internal/streams/destroy:102:25)
at Request.destroy (node:internal/streams/destroy:64:5)
at D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\core\index.js:354:26
at Request._finalizeBody (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\core\index.js:716:23)
at D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\core\index.js:333:28
at new Request (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\core\index.js:357:11)
at makeRequest (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\as-promise\index.js:35:29)
at D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\as-promise\index.js:147:9
at D:\projects\sandboxes\httpyac-test\node_modules\p-cancelable\index.js:63:11
at new Promise (<anonymous>)
at new PCancelable (D:\projects\sandboxes\httpyac-test\node_modules\p-cancelable\index.js:31:19)
at Object.asPromise [as default] (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\as-promise\index.js:33:21)
at getPromiseOrStream (D:\projects\sandboxes\httpyac-test\node_modules\got\dist\source\create.js:43:121) {
code: 'ERR_GOT_REQUEST_ERROR',
timings: undefined
}
as the parsing of the file breaks and header.name: xyz
is now considered as the request body.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
what characters are allowed in HTTP header values?
The field-name must be composed of printable ASCII characters (i.e., characters that have values between 33. and 126., decimal, ...
Read more >Special Characters in Column Names
Column names with special characters require special treatment. It is good practice for administrators to define column names that follow the SQL identifier ......
Read more >Format of HTTP request header names and values
Format of HTTP request header names and values · Alphanumeric characters: a - z , A - Z , and 0 - 9...
Read more >To use special characters in a column name, enclose the ...
To use special characters in a column name, enclose the entire name in brackets ( [] ) and add a ] to any...
Read more >The underscore (_) special character in Header names is ...
The underscore (_) special character in Header names is currently supported, and the limitations should be updated. #66430.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is the fieldValueRegExp used by JSDOM: https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/xhr/XMLHttpRequest-impl.js#L34.
This regex is the culprit: https://github.com/AnWeber/httpyac/blob/main/src/parser/parserRegex.ts#L62. I will extend according to the RFC.