Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/desktop/electron/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3478,7 +3478,15 @@ function fetchJsonViaOauthSession(url, options = {}) {
redirect: 'follow'
})
request.setHeader('Content-Type', 'application/json')
if (body) request.setHeader('Content-Length', String(body.length))
// NOTE: do NOT set Content-Length manually here. Electron's net.request
// (ClientRequest, Chromium net stack) treats Content-Length as a protected
// header it computes itself from request.write(body); setting it explicitly
// throws `net::ERR_INVALID_ARGUMENT` and the whole request fails before it
// leaves the app. This only bites the OAuth/remote path (electronNet) on
// body-bearing POSTs — e.g. POST /api/model/set from Settings → Models — while
// GET and bodyless POSTs are unaffected. The local/token path (fetchJson, Node
// http) tolerates a manual Content-Length, which is why this regressed only
// for remote-backend OAuth users.

let timedOut = false
const timer = setTimeout(() => {
Expand Down
Loading