braid-http 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +3 -3
- package/package.json +1 -1
- package/readme.md +7 -5
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -8,8 +8,8 @@ import braid_client from './braid-http-client.js'
|
|
|
8
8
|
import braid_server from './braid-http-server.js'
|
|
9
9
|
|
|
10
10
|
var fetch = braid_client.fetch,
|
|
11
|
-
|
|
11
|
+
http_client = braid_client.http,
|
|
12
12
|
http_server = braid_server
|
|
13
13
|
|
|
14
|
-
export { fetch,
|
|
15
|
-
export default { fetch,
|
|
14
|
+
export { fetch, http_client, http_server }
|
|
15
|
+
export default { fetch, http_client, http_server }
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -19,12 +19,14 @@ Node.js:
|
|
|
19
19
|
npm install braid-http
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Then in your node.js code:
|
|
23
|
-
|
|
24
22
|
```javascript
|
|
23
|
+
// Import with require()
|
|
25
24
|
require('braid-http').fetch // A polyfill for require('node-fetch')
|
|
26
|
-
require('braid-http').
|
|
25
|
+
require('braid-http').http_client // A polyfill for require('http') clients
|
|
27
26
|
require('braid-http').http_server // A polyfill for require('http') servers
|
|
27
|
+
|
|
28
|
+
// Or as es6 module
|
|
29
|
+
import {fetch, http_client, http_server} from 'braid-http'
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
## Using it in Browsers
|
|
@@ -201,10 +203,10 @@ require('http').createServer(app).listen(8583)
|
|
|
201
203
|
// Use this line if necessary for self-signed certs
|
|
202
204
|
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0
|
|
203
205
|
|
|
204
|
-
var https = require('braid-http').
|
|
206
|
+
var https = require('braid-http').http_client(require('https'))
|
|
205
207
|
// or:
|
|
206
208
|
// import braid_http from 'braid-http'
|
|
207
|
-
// https = braid_http.
|
|
209
|
+
// https = braid_http.http_client(require('https'))
|
|
208
210
|
|
|
209
211
|
https.get(
|
|
210
212
|
'https://braid.org/chat',
|