-
Notifications
You must be signed in to change notification settings - Fork 75
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
feature: support basic authentication when using a proxy #1069
feature: support basic authentication when using a proxy #1069
Conversation
Signed-off-by: Joe Becher <joe.becher@sentry.io>
c784dae
to
a28f7a1
Compare
Codecov Report
@@ Coverage Diff @@
## main #1069 +/- ##
==========================================
+ Coverage 92.34% 92.42% +0.08%
==========================================
Files 35 36 +1
Lines 1319 1333 +14
Branches 270 272 +2
==========================================
+ Hits 1218 1232 +14
Misses 69 69
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the cleanup changes! I know I'm guilty of it, but for future PRs, maybe put them in a separate PR. Makes it a lot easier to review.
import { ProxyAgent } from 'undici'; | ||
import { UploaderArgs, UploaderEnvs } from '../types'; | ||
|
||
export function addProxyIfNeeded(envs: UploaderEnvs, args: UploaderArgs): ProxyAgent | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this needs to be in it's own file. It's only being used in web
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was easier to locate it if it needed to be changed, but I can put it back in web if you would like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could put the generateHeaders
function here then if we want proxy stuff to be in one file.
src/helpers/web.ts
Outdated
method: 'POST', | ||
origin: postURL, | ||
path: `${url.pathname}${url.search}`, | ||
}, | ||
} | ||
} | ||
|
||
export function generateHeaders(envs: UploaderEnvs, initialHeaders: IncomingHttpHeaders): IncomingHttpHeaders { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced this needs to be it's own function. It feels particularly dirty since the function is called generateHeaders
, but we're giving it headers already. I think we should deal with all header generation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want a code branch here, since POST and PUT use different headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we just name it something like addProxyHeaders
then?
Yah. The refactor was needed for this PR, which is why I did it. I couldn't easily get the proxy creds to the web parts otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM barring CI
* feat: add basic auth to proxy call --------- Signed-off-by: Joe Becher <joe.becher@sentry.io>
closes #1067