`HttpClient.send` puts a header's string where `Response` says `Array String`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
Hướng nghiên cứu
Bắt đầu trong Gren/Kernel/HttpClient.js tại _HttpClient_formatResponse và so sánh nó với _HttpClient_formatResponseLegacy. Chạy bản tái hiện được liên kết bằng gren make Main --output=app && node app, sau đó xác minh rằng các giá trị của response header là các mảng, các giá trị set-cookie lặp lại được giữ nguyên và output hiện có hoàn tất mà không gặp lỗi promise-chain.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found against: gren 0.6.6, gren-lang/core 7.4.2, gren-lang/node 6.1.3, node 22
Reproduction: https://github.com/gilramir/gren-bug-reports/tree/main/2026-09-15-httpclient-header-values
HttpClient.Response's headers are a Dict String (Array String), but
HttpClient.send stores each header's value as a plain string. So for
content-type: text/plain, Array.length of the values is 10 and
Array.first is Just "t", and String.join ", " values throws inside
fetch's promise chain after the task has already succeeded: the program
silently stops, with nothing on stderr and exit status 0. A repeated
set-cookie also keeps only the last cookie.
Reproduction
gren.json dependencies: gren-lang/core 7.4.2, gren-lang/node 6.1.3. Save as src/Main.gren. Build and run with gren make Main --output=app && node app; the third row is never printed:
module Main exposing (main)
import Dict
import HttpClient
import Init
import Node
import Stream
import Task
main : Node.SimpleProgram a
main =
Node.defineSimpleProgram <| \env ->
Init.await HttpClient.initialize <| \http ->
let
print line =
Stream.writeLineAsBytes line env.stdout
|> Task.onError (\_ -> Task.succeed env.stdout)
in
Node.endSimpleProgram
(HttpClient.get "data:text/plain,x"
|> HttpClient.send http
|> Task.andThen
(\response ->
let
values =
Dict.get "content-type" response.headers |> Maybe.withDefault []
in
print "| call | result | expected |\n|---|---|---|"
|> Task.andThen (\_ -> print ("| `Array.length values` | " ++ String.fromInt (Array.length values) ++ " | 1 |"))
|> Task.andThen (\_ -> print ("| `Array.first values` | " ++ Debug.toString (Array.first values) ++ " | Just \"text/plain\" |"))
|> Task.andThen (\_ -> print ("| `String.join \", \" values` | " ++ String.join ", " values ++ " | text/plain |"))
)
|> Task.onError (\_ -> print "request failed")
)
Output:
$ node app; echo "exit status $?"
| call | result | expected |
|---|---|---|
| `Array.length values` | 10 | 1 |
| `Array.first values` | Just "t" | Just "text/plain" |
exit status 0
Cause
_HttpClient_formatResponse in Gren/Kernel/HttpClient.js, which send uses:
for (const [key, value] of res.headers.entries()) {
headerDict = A3(__Dict_set, key.toLowerCase(), value, headerDict);
}
Headers.entries() gives each value as a string. fetch already joins a
repeated header with ", ", except set-cookie, which entries() gives once
per cookie, so __Dict_set keeps only the last one. The streaming API's
_HttpClient_formatResponseLegacy reads res.headersDistinct, whose values are
arrays, and is not affected.
- Ngôn ngữ chính
- JavaScript
- Star
- 13
- Fork
- 6
- Merge trung bình
- 4 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của gren-lang/node
-
`FileSystem.makeTempDirectory` crashes the program when it fails, instead of failing the taskĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
`ChildProcess.spawn` with `NoShell` looks for a program named after the program and its argumentsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Tất cả issue của gren-lang/node
Issue tương tự
-
Complexity: Small P-Feature: Projects page ready for merge team role: back end/devOps role: front end size: 0.25pt
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
bellingcat/toolkit#905 ·
-
self-care self-care:docs-build-time-investigator
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 76/100
githubnext/gh-aw-cao#14191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort:low impact:medium RAG status: auto-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
mastra-ai/mastra#25229 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sugarlabs/musicblocks#8984 ·
Maintainer thường phản hồi trong vòng 1 ngày