This package implements the [TompHTTP Bare Server](https://github.com/tomphttp/specifications/blob/master/BareServer.md) as a client.
npm install @tomphttp/bare-clientThis package implements the TompHTTP Bare Server as a client.
See the V2 API documentation.
See the changelog.
A guide for updating from v1 to v2 can be found here.
Starting from v2, @tomphttp/bare-client only supports Bare servers v3+.
If you operate an outdated Bare server, we encourage you to update. If you're using an outdated Bare server, we encourage you to find an updated Bare server or host your own.
If you're too lazy to do either of the above, you can install an outdated and unsupported version of the Bare client.
``sh`
npm install @tomphttp/bare-client@1
Script tag:
`html`
ESM/bundler:
`sh`
npm i @tomphttp/bare-client
`js
import { createBareClient } from '@tomphttp/bare-client';
createBareClient('http://localhost:8080/bare/'); // ...
`
See examples/.
client.fetch isn't 1:1 to JavaScript's fetch. It doesn't accept a Request as an argument due to the headers on the Request being "managed":
`jsHeaders
const a = new Headers(); // unmanaged
a.set('user-agent', 'test');
a.get('user-agent'); // "test"
const b = new Request(location.toString()).headers; // managed Headers``
b.set('user-agent', 'test');
b.get('user-agent'); // null