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

Read rawBuffer for BitArray body instead of buffer #15

Merged
merged 1 commit into from
Mar 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- uses: erlef/setup-beam@v1
with:
otp-version: false
gleam-version: "1.8.1"
gleam-version: "1.9.1"
- run: gleam test
- run: gleam format --check src test
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = "1.2.0"
licences = ["Apache-2.0"]
description = "Make HTTP requests in Gleam JavaScript with Fetch"
target = "javascript"
gleam = ">= 0.32.0"
gleam = ">= 1.9.0"

repository = { type = "github", user = "gleam-lang", repo = "fetch" }
links = [
Expand Down
6 changes: 3 additions & 3 deletions src/gleam_fetch_ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function form_data_to_fetch_request(request) {

export function bitarray_request_to_fetch_request(request) {
let [url, options] = request_common(request)
if (options.method !== "GET" && options.method !== "HEAD") options.body = request.body.buffer;
if (options.method !== "GET" && options.method !== "HEAD") options.body = request.body.rawBuffer;
return new globalThis.Request(url, options);
}

Expand Down Expand Up @@ -116,13 +116,13 @@ export function setFormData(formData, key, value) {

export function appendBitsFormData(formData, key, value) {
const f = cloneFormData(formData)
f.append(key, new Blob([value.buffer]))
f.append(key, new Blob([value.rawBuffer]))
return f
}

export function setBitsFormData(formData, key, value) {
const f = cloneFormData(formData)
f.set(key, new Blob([value.buffer]))
f.set(key, new Blob([value.rawBuffer]))
return f
}

Expand Down