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

feat: pass rawHeaders #1240

Merged
merged 4 commits into from Feb 20, 2022
Merged

feat: pass rawHeaders #1240

merged 4 commits into from Feb 20, 2022

Conversation

MoLow
Copy link
Member

@MoLow MoLow commented Feb 17, 2022

add rawHeaders whenever we return headers.
hope this PR makes sense
closes #1213

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2022

Codecov Report

Merging #1240 (4b41072) into main (b081930) will increase coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1240      +/-   ##
==========================================
+ Coverage   93.87%   94.07%   +0.19%     
==========================================
  Files          43       43              
  Lines        4052     4066      +14     
==========================================
+ Hits         3804     3825      +21     
+ Misses        248      241       -7     
Impacted Files Coverage Δ
lib/api/api-connect.js 100.00% <100.00%> (ø)
lib/api/api-pipeline.js 100.00% <100.00%> (ø)
lib/api/api-request.js 100.00% <100.00%> (ø)
lib/api/api-stream.js 100.00% <100.00%> (ø)
lib/api/api-upgrade.js 100.00% <100.00%> (ø)
lib/core/util.js 98.47% <100.00%> (+0.01%) ⬆️
lib/fetch/request.js 85.47% <0.00%> (+2.90%) ⬆️

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 b081930...4b41072. Read the comment docs.

Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that this causes reduced performance for an edge case.

@ronag
Copy link
Member

ronag commented Feb 19, 2022

Can we make this an option on the request instead? i.e. whether or not to return raw headers. That way it doesn't affect performance and you get exactly what you want in the fastest way possible.

e.g.

    const {
        statusCode,
        headers, // rawHeaders
        trailers,
        body
    } = await undici.request('http://url', { responeHeaders: 'raw' });

I'm not sure what the option should be called but I think something like this.

@MoLow
Copy link
Member Author

MoLow commented Feb 19, 2022

Can we make this an option on the request instead? i.e. whether or not to return raw headers. That way it doesn't affect performance and you get exactly what you want in the fastest way possible.

e.g.

    const {
        statusCode,
        headers, // rawHeaders
        trailers,
        body
    } = await undici.request('http://url', { responeHeaders: 'raw' });

I'm not sure what the option should be called but I think something like this.

@ronag makes sense to me,

@MoLow MoLow requested a review from ronag February 20, 2022 01:06
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag ronag merged commit 17e6a0f into nodejs:main Feb 20, 2022
KhafraDev pushed a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
* Pass raw headers

* tests

* types

* CR

Co-authored-by: Moshe Atlow <moshea@testim.io>
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
* Pass raw headers

* tests

* types

* CR

Co-authored-by: Moshe Atlow <moshea@testim.io>
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* Pass raw headers

* tests

* types

* CR

Co-authored-by: Moshe Atlow <moshea@testim.io>
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.

Raw Header support
4 participants