Skip to content

Commit 2425efc

Browse files
author
James Halliday
committed
update readme format
1 parent 3098081 commit 2425efc

File tree

1 file changed

+32
-43
lines changed

1 file changed

+32
-43
lines changed

readme.markdown

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
http-browserify
2-
===============
1+
# http-browserify
32

43
The
54
[http](http://nodejs.org/docs/v0.4.10/api/all.html#hTTP) module from node.js,
@@ -9,10 +8,9 @@ When you `require('http')` in
98
[browserify](http://github.com/substack/node-browserify),
109
this module will be loaded.
1110

12-
example
13-
=======
11+
# example
1412

15-
````javascript
13+
``` js
1614
var http = require('http');
1715

1816
http.get({ path : '/beep' }, function (res) {
@@ -27,15 +25,13 @@ http.get({ path : '/beep' }, function (res) {
2725
div.innerHTML += '<br>__END__';
2826
});
2927
});
30-
````
28+
```
3129

32-
http methods
33-
============
30+
# http methods
3431

3532
var http = require('http');
3633

37-
var req = http.request(options, cb)
38-
-----------------------------------
34+
## var req = http.request(options, cb)
3935

4036
`options` can have:
4137

@@ -47,68 +43,50 @@ var req = http.request(options, cb)
4743

4844
The callback will be called with the response object.
4945

50-
var req = http.get(options, cb)
51-
-------------------------------
46+
## var req = http.get(options, cb)
5247

5348
A shortcut for
5449

55-
````javascript
50+
``` js
5651
options.method = 'GET';
5752
var req = http.request(options, cb);
5853
req.end();
59-
````
54+
```
6055

61-
request methods
62-
===============
56+
# request methods
6357

64-
req.setHeader(key, value)
65-
-------------------------
58+
## req.setHeader(key, value)
6659

6760
Set an http header.
6861

69-
req.getHeader(key)
70-
-------------------------
62+
## req.getHeader(key)
7163

7264
Get an http header.
7365

74-
req.removeHeader(key)
75-
-------------------------
66+
## req.removeHeader(key)
7667

7768
Remove an http header.
7869

79-
req.write(data)
80-
---------------
70+
## req.write(data)
8171

8272
Write some data to the request body.
8373

84-
req.end(data)
85-
-------------
74+
## req.end(data)
8675

8776
Close and send the request body, optionally with additional `data` to append.
8877

89-
response methods
90-
================
78+
# response methods
9179

92-
res.getHeader(key)
93-
------------------
80+
## res.getHeader(key)
9481

9582
Return an http header, if set. `key` is case-insensitive.
9683

97-
response attributes
98-
===================
84+
# response attributes
9985

10086
* res.statusCode, the numeric http response code
10187
* res.headers, an object with all lowercase keys
10288

103-
response events
104-
---------------
105-
106-
* data
107-
* end
108-
* error
109-
110-
compatibility
111-
=============
89+
# compatibility
11290

11391
This module has been tested and works with:
11492

@@ -123,8 +101,7 @@ and are somewhat buffered in Opera. In all the other browsers you get a nice
123101
unbuffered stream of `"data"` events when you send down a content-type of
124102
`multipart/octet-stream` or similar.
125103

126-
protip
127-
======
104+
# protip
128105

129106
You can do:
130107

@@ -136,3 +113,15 @@ var bundle = browserify({
136113

137114
in order to map "http-browserify" over `require('http')` in your browserified
138115
source.
116+
117+
# install
118+
119+
With [npm](https://npmjs.org) do:
120+
121+
```
122+
npm install http-browserify
123+
```
124+
125+
# license
126+
127+
MIT

0 commit comments

Comments
 (0)