braid-http 0.2.0 → 0.3.0
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/braid-http-client.js +2 -2
- package/braid-http-server.js +2 -2
- package/package.json +1 -1
- package/readme.md +1 -1
package/braid-http-client.js
CHANGED
|
@@ -154,7 +154,7 @@ async function braid_fetch (url, params = {}) {
|
|
|
154
154
|
|
|
155
155
|
// We provide some shortcuts for Braid params
|
|
156
156
|
if (params.version)
|
|
157
|
-
params.headers.set('version', JSON.stringify(
|
|
157
|
+
params.headers.set('version', params.version.map(JSON.stringify).join(', '))
|
|
158
158
|
if (params.parents)
|
|
159
159
|
params.headers.set('parents', params.parents.map(JSON.stringify).join(', '))
|
|
160
160
|
if (params.subscribe)
|
|
@@ -487,7 +487,7 @@ function parse_headers (input) {
|
|
|
487
487
|
|
|
488
488
|
// Success! Let's parse special headers
|
|
489
489
|
if ('version' in headers)
|
|
490
|
-
headers.version = JSON.parse(headers.version)
|
|
490
|
+
headers.version = JSON.parse('['+headers.version+']')
|
|
491
491
|
if ('parents' in headers)
|
|
492
492
|
headers.parents = JSON.parse('['+headers.parents+']')
|
|
493
493
|
if ('patches' in headers)
|
package/braid-http-server.js
CHANGED
|
@@ -335,10 +335,10 @@ function send_version(res, data, url, peer) {
|
|
|
335
335
|
// Version and Parents get output in the Structured Headers format
|
|
336
336
|
if (header === 'version') {
|
|
337
337
|
header = 'Version' // Capitalize for prettiness
|
|
338
|
-
value = JSON.stringify(
|
|
338
|
+
value = value.map(JSON.stringify).join(", ")
|
|
339
339
|
} else if (header === 'parents') {
|
|
340
340
|
header = 'Parents' // Capitalize for prettiness
|
|
341
|
-
value =
|
|
341
|
+
value = value.map(JSON.stringify).join(", ")
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
// We don't output patches or body yet
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Braid-HTTP
|
|
2
2
|
|
|
3
|
-
This polyfill library implements the [Braid-HTTP
|
|
3
|
+
This polyfill library implements the [Braid-HTTP v04 protocol](https://github.com/braid-org/braid-spec/blob/master/draft-toomim-httpbis-braid-http-04.txt) in Javascript. It gives browsers a `braid_fetch()` drop-in replacement for the `fetch()` API, and gives nodejs an `http` plugin, allowing them to speak Braid in a simple way.
|
|
4
4
|
|
|
5
5
|
Developed in [braid.org](https://braid.org).
|
|
6
6
|
|