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 decimal and nil header encoding #189

Merged
merged 2 commits into from
Sep 3, 2024
Merged

Fix decimal and nil header encoding #189

merged 2 commits into from
Sep 3, 2024

Conversation

ptoffy
Copy link
Member

@ptoffy ptoffy commented Sep 1, 2024

This aims to fix the issues discovered in #188

  1. nil wasn't being added because assigning nil to a field would remove it from the dict. Now assigning nil to a field actually adds an explicit null value to the json, while there's a remove(field:) method to remove fields from the header
  2. decimal wasn't being decoded correctly because it was trying to unwrap Doubles as Ints

Copy link

codecov bot commented Sep 1, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.86%. Comparing base (5d90471) to head (e6165cc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
Sources/JWTKit/JWTHeader.swift 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #189      +/-   ##
==========================================
+ Coverage   78.76%   78.86%   +0.09%     
==========================================
  Files          60       60              
  Lines        1413     1424      +11     
==========================================
+ Hits         1113     1123      +10     
- Misses        300      301       +1     
Files with missing lines Coverage Δ
Sources/JWTKit/JWTHeaderField.swift 71.79% <100.00%> (+1.93%) ⬆️
Sources/JWTKit/JWTHeader.swift 89.65% <90.90%> (-1.65%) ⬇️

Copy link
Contributor

@fpseverino fpseverino left a comment

Choose a reason for hiding this comment

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

LGTM

@ptoffy ptoffy merged commit 81be268 into main Sep 3, 2024
10 checks passed
@ptoffy ptoffy deleted the header-fixes branch September 3, 2024 13:05
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.

3 participants