mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-15 14:22:43 +00:00
18 lines
528 B
TypeScript
18 lines
528 B
TypeScript
/**
|
|
* Helpers for Electron net.request calls that ride the OAuth session partition.
|
|
*
|
|
* Electron's ClientRequest forbids app-set restricted headers such as
|
|
* Content-Length. Let Chromium frame the body itself; only set the JSON content
|
|
* type here.
|
|
*/
|
|
|
|
function serializeJsonBody(body) {
|
|
return body === undefined ? undefined : Buffer.from(JSON.stringify(body))
|
|
}
|
|
|
|
function setJsonRequestHeaders(request) {
|
|
request.setHeader('Content-Type', 'application/json')
|
|
}
|
|
|
|
export { serializeJsonBody,
|
|
setJsonRequestHeaders }
|