Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 84 lines (54 sloc) 1.651 kb
598f761 @tj Initial commit
authored
1
2 # Better curl(1)
3
7f8dd72 @tj typo
authored
4 `burl(1)` is a tiny shell script augmenting `curl(1)` with some helpful shortcuts.
598f761 @tj Initial commit
authored
5
6 ## Installation
7
8 $ make install
9
10 ## Optional hostname
11
12 By default `burl(1)` will assume "http://localhost:3000", however you
6c83a0f @tj docs
authored
13 can alter this default by exporting `BURL` in your terminal session or `.profile`:
598f761 @tj Initial commit
authored
14
15 ```
7f8dd72 @tj typo
authored
16 $ export BURL=http://site-im-testing.com
598f761 @tj Initial commit
authored
17 $ burl /pathname
18 ```
19
6c83a0f @tj docs
authored
20 Or like usual you can specify a full url:
21
22 ```
23 $ burl http://google.com
24 ```
25
598f761 @tj Initial commit
authored
26 ## -j, --json DATA
27
28 __POST__ data as "Content-Type: application/json":
29
30 ```
2a1cc60 @tj docs
authored
31 $ burl -j {"name":"tobi"} /user
598f761 @tj Initial commit
authored
32 ```
33
6b5bbf6 @tj add expressive http verb usage
authored
34 ## HTTP verbs
35
36 Instead of the typical `-X DELETE` verb usage with `curl(1)`, you may use
37 the verbs directly, for example:
38
39 ```
40 $ burl PATCH -d 'email=tobi@learnboost.com' /user/12
41 $ burl DELETE /users
42 ```
43
d834812 @tj add JSON shorthands
authored
44 ## JSON request bodies
45
46 Usually when you want to request with some JSON you do something like:
47
48 ```
49 $ curl -X PATCH -d '{"name":"tobi"}' -H "Content-Type: application/json" http://localhost:3000/user/12
50 ```
51
52 With `burl(1)` you can simply add a JSON array or object after the HTTP verb:
53
54 ```
55 $ burl PATCH '{"name":"tobi"}' /user/12
e3dc89c @tj fix previous commit, not just POST
authored
56 $ burl POST [1,2,3] /numbers
d834812 @tj add JSON shorthands
authored
57 ```
58
59
598f761 @tj Initial commit
authored
60 ## Expressive header fields
61
62 With `burl(1)` you can define header fields without `-H`:
63
64 ```
e46b825 @tj docs
authored
65 $ burl If-None-Match: etag /users
66 $ burl If-None-Match: etag Accept: application/json /users
598f761 @tj Initial commit
authored
67 ```
68
69 ## Accept shorthand
70
71 Currently `.json`, `.text` and `.html` shorthands are
72 available and set the Accept header field for you:
73
74 ```
75 $ burl /users
76 $ burl /users .json
77 $ burl /users .text
78 $ burl /users .html
79 ```
047cb5d @fizerkhan Fixed issue in json option.
fizerkhan authored
80
81 ## Extras
82
83 * Added support for prettyjson. It needs python and json.tool module.
Something went wrong with that request. Please try again.