Skip to content

Instantly share code, notes, and snippets.

@carymrobbins
Last active February 28, 2022 21:24
Show Gist options
  • Save carymrobbins/ff88a97c23b40e4c74597d72e6bab67b to your computer and use it in GitHub Desktop.
Save carymrobbins/ff88a97c23b40e4c74597d72e6bab67b to your computer and use it in GitHub Desktop.

Revisions

  1. carymrobbins renamed this gist Feb 28, 2022. 1 changed file with 0 additions and 0 deletions.
  2. carymrobbins revised this gist Feb 28, 2022. 2 changed files with 24 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions curl-post-with-query-and-body.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +0,0 @@
    #!/usr/bin/env bash

    curl \
    -XPOST https://httpbin.org/post \
    -G \
    --data-urlencode foo=bar \
    --data-urlencode baz=quux \
    -T <(echo -n '{"spam": "eggs"}')
    24 changes: 24 additions & 0 deletions curl-post-with-query-and-body.sh-session
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    % curl \
    -XPOST https://httpbin.org/post \
    -G \
    --data-urlencode foo=bar \
    --data-urlencode baz=quux \
    -T <(echo -n '{"spam": "eggs"}')

    {
    "args": {
    "baz": "quux",
    "foo": "bar"
    },
    "data": "{\"spam\": \"eggs\"}",
    "files": {},
    "form": {},
    "headers": {
    "Accept": "*/*",
    "Host": "httpbin.org",
    },
    "json": {
    "spam": "eggs"
    },
    "url": "https://httpbin.org/post?foo=bar&baz=quux"
    }
  3. carymrobbins created this gist Feb 28, 2022.
    8 changes: 8 additions & 0 deletions curl-post-with-query-and-body.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/usr/bin/env bash

    curl \
    -XPOST https://httpbin.org/post \
    -G \
    --data-urlencode foo=bar \
    --data-urlencode baz=quux \
    -T <(echo -n '{"spam": "eggs"}')