Paw-cURLImporter
Paw-cURLImporter copied to clipboard
Paw importer for cURL command lines
cURL Importer (Paw Extension)
A Paw Extension to import cURL commands into Paw.
Installation
Easily install this Paw Extension: Install cURL Importer
How to use?
- In Paw, go to File menu, then Import Text...
- Paste the cURL command, and make sure the Format is cURL Importer
Available cURL Options
This importer does not support the full cURL syntax. Supported arguments are:
General
--urlor last string, will set the url (including protocol, http etc) (see curl --url)-X, --requestdefine method, default to automatic (GET, or POST if body data is present) (see curl -X)-I, --headsets the method toHEAD(see curl -I)-m, --max-timesets the request timeout in seconds (see curl -m)
Headers
-H, --headerdefine header (use:to separate name and value) (see curl -H)-e, --refererwill set aRefererheader (see curl -e)-A, --user-agentwill set aUser-Agentheader (see curl -A)-b, --cookiewill set aCookieheader (see curl -b)--compressedwill appendgzipto encoding headers (see curl --compressed)
Auth
-u, --userdefine username and password for HTTP Basic Auth (can also define in the URL with the formathttp://username:[email protected]) (see curl -u)
Body
-d, --dataset body data (see curl -H)--data-asciisame as-d, --data(see curl --data-ascii)--data-binarysame as-d, --data, but newlines won't be stripped in files (behavior not yet supported here) (see curl --data-binary)--data-rawsame as-d, --data, but no file references will be parsed (see curl --data-raw)--data-urlencodeset body data, data will be url-encoded (see curl --data-urlencode)-F, -formset body asmultipart/form-data(see curl -F)--form-stringsame as-F, -form, but no file references will be parsed (see curl --form-string)
Separators
-:and--nextwill separate next URLs from the options before this option (see curl -:)- all common shell separators will be interpreted as a new curl request (
&,&&,|, etc.) - shell redirections (
>,2>, etc.) will be ignored, but arguments after are still parsed (e.g.curl httpbin.org/post > output.txt -d key=valueworks)
Short Options
Short options may be joined with their value in the same argument (e.g. both -X POST with a space and -XPOST without space are valid).
Quotes
'single quotes "Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash." (man bash)"double quotes "Enclosing characters in double quotes preserves the literal value of all characters within the quotes...The backslash retains its special meaning only when followed by one of the following characters: $, `, ", , or. A double quote may be quoted within double quotes by preceding it with a backslash." (man bash)$''"dollar sign" quotes "Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded..." (man bash), this extension supports the same escapes as bash:- standard escapes:
\n,\r,\t,\a,\b,\f,\v,\e,\E,\\,\',\" - octal escapes:
\nnn"the eight-bit character whose value is the octal value nnn (one to three digits)" - hexadecimal escapes:
\xHH"the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)" \cxcontrol characters
- standard escapes:
Files
Do to OS X sandboxing, Paw cannot read from local files. All file references used in curl commands will be replaced by an empty FileDynamicValue.
Examples
Basic Auth
curl https://myuser:[email protected]/get
curl https://httpbin.org/get -u myuser:mypassword
application/json
curl http://httpbin.org/post -d '{"key":"va=l&u=e"}' -H Content-Type:application/json
Development
Prerequisites
nvm install
nvm use
npm install
Build
npm run build
Install
make install
Test
npm test
License
This Paw Extension is released under the MIT License. Feel free to fork, and modify!
Copyright © 2015 Paw Inc.
Contributors
See Contributors.