`HttpClient.send` puts a header's string where `Response` says `Array String`
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
調査の方向性
Gren/Kernel/HttpClient.js の _HttpClient_formatResponse から始め、_HttpClient_formatResponseLegacy と比較します。gren make Main --output=app && node app でリンク先の再現を実行し、response header の値が配列であること、繰り返された set-cookie の値が保持されること、既存の出力が promise-chain failure なしに完了することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 13
- フォーク
- 6
- 平均マージ
- 4日 12時間
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gren-lang/node のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
`ChildProcess.spawn` with `NoShell` looks for a program named after the program and its argumentsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
parse-community/parse-server#10699 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: dashboard bug perceived difficulty: 3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
メンテナーはふだん 1 日以内に返信
-
Aframe enhancement javascript
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
webarkit/Aframe-nft#17 ·
-
spec-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100