Skip to content

Commit 097cc81

Browse files
authored
Merge pull request #39 from takker99/fix-typo
🐛 s/res.json()/res.text()/g
2 parents f5c82ac + b8fbad7 commit 097cc81

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

rest/getTweetInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ export const getTweetInfo = async (
5454
},
5555
};
5656
}
57-
const text = await res.json();
57+
const text = await res.text();
5858
const value = tryToErrorLike(text);
5959
if (!value) {
6060
throw new UnexpectedResponseError({
6161
path: new URL(path),
6262
...res,
63-
body: await res.text(),
63+
body: text,
6464
});
6565
}
6666
return {

rest/getWebPageTitle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export const getWebPageTitle = async (
5353
},
5454
};
5555
}
56-
const text = await res.json();
56+
const text = await res.text();
5757
const value = tryToErrorLike(text);
5858
if (!value) {
5959
throw new UnexpectedResponseError({
6060
path: new URL(path),
6161
...res,
62-
body: await res.text(),
62+
body: text,
6363
});
6464
}
6565
return {

rest/page-data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ export const importPages = async (
5151
);
5252

5353
if (!res.ok) {
54-
const text = await res.json();
54+
const text = await res.text();
5555
const value = tryToErrorLike(text);
5656
if (!value) {
5757
throw new UnexpectedResponseError({
5858
path: new URL(path),
5959
...res,
60-
body: await res.text(),
60+
body: text,
6161
});
6262
}
6363
return { ok: false, value };
@@ -94,13 +94,13 @@ export const exportPages = async <withMetadata extends true | false>(
9494
);
9595

9696
if (!res.ok) {
97-
const text = await res.json();
97+
const text = await res.text();
9898
const value = tryToErrorLike(text);
9999
if (!value) {
100100
throw new UnexpectedResponseError({
101101
path: new URL(path),
102102
...res,
103-
body: await res.text(),
103+
body: text,
104104
});
105105
}
106106
return {

rest/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ export const getProject = async (
3232
);
3333

3434
if (!res.ok) {
35-
const text = await res.json();
35+
const text = await res.text();
3636
const value = tryToErrorLike(text);
3737
if (!value) {
3838
throw new UnexpectedResponseError({
3939
path: new URL(path),
4040
...res,
41-
body: await res.text(),
41+
body: text,
4242
});
4343
}
4444
return {

rest/replaceLinks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export const replaceLinks = async (
4747
);
4848

4949
if (!res.ok) {
50-
const text = await res.json();
50+
const text = await res.text();
5151
const value = tryToErrorLike(text);
5252
if (!value) {
5353
throw new UnexpectedResponseError({
5454
path: new URL(path),
5555
...res,
56-
body: await res.text(),
56+
body: text,
5757
});
5858
}
5959
return {

rest/search.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export const searchForPages = async (
4747
},
4848
};
4949
}
50-
const text = await res.json();
50+
const text = await res.text();
5151
const value = tryToErrorLike(text);
5252
if (!value) {
5353
throw new UnexpectedResponseError({
5454
path: new URL(path),
5555
...res,
56-
body: await res.text(),
56+
body: text,
5757
});
5858
}
5959
return {
@@ -100,13 +100,13 @@ export const searchForJoinedProjects = async (
100100
},
101101
};
102102
}
103-
const text = await res.json();
103+
const text = await res.text();
104104
const value = tryToErrorLike(text);
105105
if (!value) {
106106
throw new UnexpectedResponseError({
107107
path: new URL(path),
108108
...res,
109-
body: await res.text(),
109+
body: text,
110110
});
111111
}
112112
return { ok: false, value: value as NotLoggedInError };
@@ -162,13 +162,13 @@ export const searchForWatchList = async (
162162
},
163163
};
164164
}
165-
const text = await res.json();
165+
const text = await res.text();
166166
const value = tryToErrorLike(text);
167167
if (!value) {
168168
throw new UnexpectedResponseError({
169169
path: new URL(path),
170170
...res,
171-
body: await res.text(),
171+
body: text,
172172
});
173173
}
174174
return { ok: false, value: value as NotLoggedInError };

0 commit comments

Comments
 (0)