Skip to content

Commit

Permalink
fix: set accept: application/x-ndjson in fetching live logs (#194)
Browse files Browse the repository at this point in the history
This commit sets `accept: application/x-ndjson` header when fetching live logs.

Fixes #188
  • Loading branch information
magurotuna authored Nov 17, 2023
1 parent 5ddf441 commit 5aa4fee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
export interface RequestOptions {
method?: string;
body?: unknown;
accept?: string;
}

export class APIError extends Error {
Expand Down Expand Up @@ -94,7 +95,7 @@ export class API {
await this.#authorization.get() ?? await this.#authorization.provision()
}`;
const headers = {
"Accept": "application/json",
"Accept": opts.accept ?? "application/json",
"Authorization": authorization,
...(opts.body !== undefined
? opts.body instanceof FormData
Expand Down Expand Up @@ -187,6 +188,9 @@ export class API {
): AsyncIterable<LiveLog> {
return this.#requestStream(
`/projects/${projectId}/deployments/${deploymentId}/logs/`,
{
accept: "application/x-ndjson",
},
);
}

Expand Down

0 comments on commit 5aa4fee

Please sign in to comment.