-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] Removing Axios for Native Fetch #1278
base: main
Are you sure you want to change the base?
Conversation
url: downloadUri, | ||
responseType: 'stream', | ||
}) | ||
|
||
const { data: checksum }: { data: string } = await sendHttpRequest({ | ||
const { data: downloadStream } = (await resp.json()) as { data: Stream } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get stream from resp.body
instead of resp.json()
?
ref https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams
} | ||
|
||
private async report(): Promise<void> { | ||
// Create a task data object | ||
const taskData = { | ||
apiKey: this.apiKey, | ||
httpClient: this.httpClient, | ||
// httpClient: this.httpClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code ?
} event for Alert ID: ${alertId} failed. ${(error as Error).message}` | ||
) | ||
try { | ||
const resp = await sendHttpRequestFetch({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this API call is missing x-api-key
header ?
maybe we can create a reusable function inside symon client, something like
private fetcher() {
sendHttpRequestFetch({
// base url
// common headers
})
}
const resp = await sendHttpRequestFetch({ | ||
url: `${this.url}/api/${this.apiVersion}/${this.monikaId}/probes`, | ||
method: 'GET', | ||
headers: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another one with no x-api-key header
url: `${this.url}/api/${this.apiVersion}/monika/client-handshake`, | ||
method: 'POST', | ||
body: JSON.stringify(handshakeData), | ||
headers: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another one without x-api-key
header
Monika Pull Request (PR)
What feature/issue does this PR add
How did you implement / how did you fix it
How to test
npm start -- -c test.yaml
should worknpm test
should all passmonika -c https://raw.githubusercontent.com/hyperjumptech/monika/main/config_sample/config.desktop.example.yml
should be fetched properlymonika --auto-update patch
should work