Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions rest/getTweetInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export const getTweetInfo = async (
},
};
}
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down
4 changes: 2 additions & 2 deletions rest/getWebPageTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export const getWebPageTitle = async (
},
};
}
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down
8 changes: 4 additions & 4 deletions rest/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const importPages = async (
);

if (!res.ok) {
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return { ok: false, value };
Expand Down Expand Up @@ -94,13 +94,13 @@ export const exportPages = async <withMetadata extends true | false>(
);

if (!res.ok) {
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down
4 changes: 2 additions & 2 deletions rest/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export const getProject = async (
);

if (!res.ok) {
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down
4 changes: 2 additions & 2 deletions rest/replaceLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export const replaceLinks = async (
);

if (!res.ok) {
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down
12 changes: 6 additions & 6 deletions rest/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export const searchForPages = async (
},
};
}
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return {
Expand Down Expand Up @@ -100,13 +100,13 @@ export const searchForJoinedProjects = async (
},
};
}
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return { ok: false, value: value as NotLoggedInError };
Expand Down Expand Up @@ -162,13 +162,13 @@ export const searchForWatchList = async (
},
};
}
const text = await res.json();
const text = await res.text();
const value = tryToErrorLike(text);
if (!value) {
throw new UnexpectedResponseError({
path: new URL(path),
...res,
body: await res.text(),
body: text,
});
}
return { ok: false, value: value as NotLoggedInError };
Expand Down