fix: set json content type for spacetime web api
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -105,10 +105,11 @@ export async function callSpacetimeProcedure(options, procedureName, input) {
|
||||
const serverUrl = resolveServerUrl(options).replace(/\/+$/u, '');
|
||||
const url = `${serverUrl}/v1/database/${encodeURIComponent(options.database)}/call/${encodeURIComponent(procedureName)}`;
|
||||
const headers = {
|
||||
'content-type': 'application/json; charset=utf-8',
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (options.token) {
|
||||
headers.authorization = `Bearer ${options.token}`;
|
||||
headers.Authorization = `Bearer ${options.token}`;
|
||||
}
|
||||
|
||||
let response;
|
||||
@@ -136,9 +137,13 @@ export async function callSpacetimeProcedure(options, procedureName, input) {
|
||||
export async function createSpacetimeWebIdentity(options) {
|
||||
const serverUrl = resolveServerUrl(options).replace(/\/+$/u, '');
|
||||
const url = `${serverUrl}/v1/identity`;
|
||||
const headers = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
let response;
|
||||
try {
|
||||
response = await fetch(url, { method: 'POST' });
|
||||
response = await fetch(url, { method: 'POST', headers });
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`SpacetimeDB identity 请求失败: ${url}; ${error instanceof Error ? error.message : String(error)}`,
|
||||
|
||||
Reference in New Issue
Block a user