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: various fetch issues #5

Merged
merged 9 commits into from
Apr 8, 2024

Conversation

ericlewis
Copy link
Contributor

This tries to bring fetch more in line with specs & fixes some bugs

HTTP method is being set to undefined when a request doesn't provide a method. Check that the property exists before attempting to set it.
Fetch requests can sometimes be passed an entire Request object, handle that scenario.
As per the standard.
@theolampert
Copy link
Owner

Thanks for this @ericlewis I'll take a look

Copy link
Owner

@theolampert theolampert left a comment

Choose a reason for hiding this comment

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

@ericlewis Looks good thank you, I only had one comment.

Would you also be able to let me know what issues you ran into so I can add those to the header and fetch tests?

let headersClass: @convention(block) () -> Headers = {
Headers()
let headersClass: @convention(block) (JSValue?) -> Headers = { headers in
if let headers {
Copy link
Owner

Choose a reason for hiding this comment

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

I think you'll also need to check if the underlying JSValue is also null or undefined here, there's a helper for this. Something like:

if let headers, headers.hasValue {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry for not seeing this. did you make the change?

Copy link
Owner

Choose a reason for hiding this comment

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

Yep, all good, thanks again for the contribution!

@theolampert theolampert merged commit e7d2306 into theolampert:main Apr 8, 2024
1 check failed
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.

2 participants