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 some headers to child requests #9

Closed
wants to merge 1 commit into from

Conversation

dkarlovi
Copy link
Contributor

Closes #5.

@dkarlovi
Copy link
Contributor Author

@dunglas would appreciate your feedback too.

@darkweak
Copy link
Owner

https://github.com/darkweak/go-esi/pull/9/files#diff-49119e92a6bdccc63d27f7f553246cf3297eb16dc4a8cc08fa2ab344351facacR91
Apply these changes below:

	if (err != nil || response.StatusCode >= 400) && i.alt != "" {
		rq, _ = http.NewRequest(http.MethodGet, sanitizeURL(i.alt, req.URL), nil)
		addHeaders(headersSafe, req, rq)
		if rq.URL.Scheme == req.URL.Scheme && rq.URL.Host == req.URL.Host {
			addHeaders(headersUnsafe, req, rq)
		}
		response, err = client.Do(rq)

		if err != nil || response.StatusCode >= 400 {
			return nil, len(b)
		}
	}

	if response == nil {
		return nil, i.length
	}

@dkarlovi
Copy link
Contributor Author

Closing here so not to cause conflicts in #10, see #10 (comment)

@dkarlovi dkarlovi closed this Nov 23, 2022
@dkarlovi dkarlovi deleted the feat/include-headers branch December 19, 2022 20:44
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.

ESI include should pass some original req's headers into the new request
2 participants