Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

[dev] Handles cf-ew-raw- headers #884

Merged
merged 28 commits into from
Dec 16, 2019

Conversation

EverlastingBugstopper
Copy link
Contributor

Fixes #873

worker code returns stringified headers in the response body:

async function handleRequest(request) {
  let headers = new Map(request.headers)
  return new Response(mapToString(headers))
}
$ curl http://localhost:8000 -H "Hi: There"
{"accept":"*/*","hi":"There","host":"example.com","user-agent":"curl/7.64.1","x-forwarded-proto":"https"}

@EverlastingBugstopper EverlastingBugstopper changed the title [proxy] Sends cf-ew-raw header on request [dev] Sends cf-ew-raw header on request Nov 20, 2019
@EverlastingBugstopper EverlastingBugstopper force-pushed the avery/look-ma-real-headers branch 2 times, most recently from f1e4c2d to 6a5a226 Compare December 2, 2019 20:59
Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

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

Small request!

src/commands/dev/mod.rs Outdated Show resolved Hide resolved
@EverlastingBugstopper EverlastingBugstopper changed the title [dev] Sends cf-ew-raw header on request [dev] Handles cf-ew-raw- headers Dec 16, 2019
Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

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

Some nits as well as suggestions for moving variables around :)

)
let client = client.to_owned();
let preview_id = preview_id.to_owned();
let server_config = server_config.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to clone this twice? (once in line 49, once here?) I feel like we can put variables like client, preview_id, and server_config in the arguments section move |args| and avoid unnecessary clones :)

src/commands/dev/mod.rs Outdated Show resolved Hide resolved
src/commands/dev/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

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

Looks great!!

@EverlastingBugstopper EverlastingBugstopper merged commit 52808ca into avery/a-time-sync Dec 16, 2019
@delete-merged-branch delete-merged-branch bot deleted the avery/look-ma-real-headers branch December 16, 2019 20:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants