question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support the special character '.' in header names

See original GitHub issue

Background

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:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AnWebercommented, Nov 27, 2021
1reaction
AnWebercommented, Nov 26, 2021

This regex is the culprit: https://github.com/AnWeber/httpyac/blob/main/src/parser/parserRegex.ts#L62. I will extend according to the RFC.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found