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

fix: undefined headers breaks compatibility with auth #66

Merged
merged 2 commits into from
Aug 7, 2019

Conversation

bcoe
Copy link
Contributor

@bcoe bcoe commented Aug 7, 2019

allowing an undefined value for header values breaks compatibility withgoogle-auth-library-nodejs:

                                 ~~~~~~~~~~~~~~~~~

test/test.jwt.ts:273:19 - error TS2532: Object is possibly 'undefined'.

273   const decoded = got.Authorization.replace('Bearer ', '');
                      ~~~~~~~~~~~~~~~~~

test/test.jwtaccess.ts:61:30 - error TS2532: Object is possibly 'undefined'.

61   const decoded = jws.decode(headers.Authorization.replace('Bearer ', ''));
                                ~~~~~~~~~~~~~~~~~~~~~

test/test.jwtaccess.ts:72:30 - error TS2532: Object is possibly 'undefined'.

72   const decoded = jws.decode(headers.Authorization.replace('Bearer ', ''));

Unless we have a pressing need to set undefined headers, I recommend we revert this change for the time being.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 7, 2019
@codecov
Copy link

codecov bot commented Aug 7, 2019

Codecov Report

Merging #66 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   67.82%   67.91%   +0.09%     
==========================================
  Files           1        1              
  Lines         345      346       +1     
  Branches       28       28              
==========================================
+ Hits          234      235       +1     
  Misses        110      110              
  Partials        1        1
Impacted Files Coverage Δ
src/index.ts 67.91% <100%> (+0.09%) ⬆️

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 dd4a6df...d6c2566. Read the comment docs.

@callmehiphop
Copy link
Contributor

Is this technically a breaking change?

@JustinBeckwith
Copy link
Contributor

Nope! It's loosening the accepted values, not making them stricter, so I'm ok with it :)

@callmehiphop
Copy link
Contributor

Oh whoops, I didn't realize it was any. Ignore me, lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants