fj api cannot read a request body from stdin or a file (no --input -, no @file) #126
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
fj apican only take a request body as an inline--input '<json string>'.There is no way to stream the body from stdin (
--input -) or read it from afile (
--input @path, or-f key=@file), unlikegh api. For CI thatgenerates request payloads on the fly (heredocs,
jqoutput, files produced by abuild step), this means shelling the whole JSON document onto one command line.
Evidence
--inputis parsed as a literal JSON string and nothing else(
src/cli/api.rs:137):There is no
-/@filehandling here or insplit_kv(src/cli/api.rs:259),and the
-f/-Ffield parsers (src/cli/api.rs:143-167) treat every value asa literal string / literal JSON, so
-f body=@payload.jsonsends the literaltext
@payload.json. The doc comment on the field even says values are takenverbatim (
src/cli/api.rs:40"Send a literal JSON request body").Why it matters for CI/automation buyers
gh apiusers routinely do:With fj that pipe is impossible: you must inline-escape the JSON into
--input,which breaks the moment the payload contains shell metacharacters, is generated
by another tool, or exceeds a comfortable command-line length. This is the
single most common
gh apiwrite idiom and it has no fj equivalent.Proposed shape
--input -reads the request body from stdin until EOF.--input @pathreads the request body from a file.-F key=@path(gh-style) so a single field can be sourcedfrom a file. (gh reserves
@-for stdin and@filefor a file on-F.)Keep the existing inline-string behavior for any value that is not
-/@....Scope
fj apipassthrough only. Sibling to the resource-command body-file gap inrasterstate/fj#124 (
-F/--body-filefor issue/pr/release/milestone), but thatissue is about human prose bodies; this is about raw HTTP request bodies on the
apiescape hatch.Converted to backlog item rasterstate/fj#136 (p1, size S).