Skip to content

Add Redirect Input to receive raw payload request bodyย #33

@talis-fb

Description

@talis-fb

The objective is to replicate this feature in HTTPie: https://httpie.io/docs/cli/redirected-input

Accept user for passing request data is through redirected stdin (standard input)โ€”piping.
Receiving the inputs from this method is similar to using --raw flag with the content passed in stdin.

treq PUT api.com/put < files/data.json
echo -n '{"name": "John"}' | http PATCH api.com/patch Auth:None

These three command are equivalent (consider the file.json with content as {"name": "Thales"})

treq POST api.com/post --raw '{"name": "Thales"}'
echo '{"name": "Thales"}' | treq POST api.com/post
treq POST api.com/post < file.json
cat file.json | treq POST api.com/post

Additional Considerations:

It's really important use the same abstraction used by --raw flag. That way is even possible to merge the input from this with request items.

This command

echo '{ "name": "John", "age": 21 }' | treq POST api.com/post job=dev role=admin

would request with body...

{ 
  "name": "John",
  "age": 21,
  "job": "dev",
  "role": "admin"
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    ๐Ÿ“‹ Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions