-
Notifications
You must be signed in to change notification settings - Fork 127
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: support automatic json body for post requests #7
Conversation
* test for pure object proto * avoid try/catch * don't add duplicate header
Codecov Report
@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 97.61% 98.27% +0.65%
==========================================
Files 4 4
Lines 42 58 +16
Branches 8 14 +6
==========================================
+ Hits 41 57 +16
Misses 1 1
Continue to review full report at Codecov.
|
} else if ('set' in options.headers) { | ||
;(options.headers as Headers).set(key, value) | ||
} else { | ||
const existingHeader = Object.keys(options.headers).find(header => header.toLowerCase() === key) |
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.
By early returning on set in
case, we can dedup this line
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.
not quite sure how to dedupe it - though it feels very close with the array/object syntax. how were you thinking?
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.
By early return in first if case we can move variable to outer scope :)
It think would be nice mentioning this feature in readme :) |
closes #4