syumai / workers

Go package to run an HTTP server on Cloudflare Workers.
MIT License
642 stars 39 forks source link

add jsutil.MaybeInt wrapper; apply it to IncomingProperties.Asn #120

Closed Skee closed 2 months ago

Skee commented 2 months ago

What

Adds a MaybeInt js.Value wrapper to jsutil.

Motivation

Cloudflare sometimes provides a cf object with no asn key. This causes cloudflare/fetch.NewIncomingProperties() to panic. This is described in #119.

This change adds a js.Value wrapper for ints which first verifies if the Value is undefined.

syumai commented 2 months ago

@Skee I've released this patch as v0.26.2. Thank you for your contribution! 🎉 https://github.com/syumai/workers/releases/tag/v0.26.2