Skip to content

Commit

Permalink
fixed last compile error. and add test for Horizon.Server custom header
Browse files Browse the repository at this point in the history
  • Loading branch information
celestialkylin committed Jun 16, 2024
1 parent 5135243 commit 27d9de1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/horizon/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ export namespace Server {
appName?: string;
appVersion?: string;
authToken?: string;
headers?: Record<string, string>;
}

export interface Timebounds {
Expand Down
22 changes: 22 additions & 0 deletions test/integration/client_headers_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,26 @@ describe("integration tests: client headers", function (done) {
.stream({ onerror: (err) => done(err) });
});
});

it("sends client via custom headers", function (done) {
let server;

const requestHandler = (request, response) => {
expect(request.headers["authorization"]).to.be.equal("123456789");
response.end();
server.close(() => done());
};

server = http.createServer(requestHandler);
server.listen(port, (err) => {
if (err) {
done(err);
return;
}

new Horizon.Server(`http://localhost:${port}`, { headers: { "authorization": "123456789" }, allowHttp: true })
.operations()
.call();
});
});
});

0 comments on commit 27d9de1

Please sign in to comment.