Skip to content

Commit 87824fc

Browse files
authored
bugfix/axios-error (#166)
* Upgrade axios to 0.21.4 * Don't pre-stringified json-ld
1 parent 4344c94 commit 87824fc

File tree

9 files changed

+31
-23
lines changed

9 files changed

+31
-23
lines changed

features/ati/AtiExportAnnotations/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const AtiExportAnnotations: FC<AtiExportAnnotationstProps> = ({
187187
}),
188188
{
189189
headers: {
190-
"Content-type": "application/json",
190+
"Content-Type": "application/json",
191191
},
192192
}
193193
)

package-lock.json

Lines changed: 19 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@prisma/client": "^2.27.0",
5151
"@types/carbon-components-react": "^7.44.0",
5252
"@types/carbon__icons-react": "^10.31.2",
53-
"axios": "^0.21.2",
53+
"axios": "^0.21.4",
5454
"axios-retry": "^3.2.4",
5555
"carbon-components": "^10.45.0",
5656
"carbon-components-react": "^7.45.0",

pages/api/arcore/[id]/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
5959
{
6060
headers: {
6161
Authorization: `Bearer ${hypothesisApiToken}`,
62-
"Content-type": "application/json",
62+
"Content-Type": "application/json",
6363
[REQUEST_DESC_HEADER_NAME]: `Sending annotations from source manuscript ${id} to Hypothes.is server`,
6464
},
6565
}

pages/api/datasets/[id]/annorep/delete.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
2121
const { status, data } = await axiosClient({
2222
method: "PUT",
2323
url: `${process.env.DATAVERSE_SERVER_URL}/api/datasets/${id}/metadata/delete`,
24-
data: JSON.stringify({
24+
data: {
2525
[ANNOREP_METADATA_FIELD]: ANNOREP_METADATA_VALUE,
26-
}),
26+
},
2727
headers: {
28-
"Content-type": "application/json-ld", //TODO: change ld+json?
28+
"Content-Type": "application/json-ld", //TODO: change ld+json?
2929
[DATAVERSE_HEADER_NAME]: session.dataverseApiToken,
3030
[REQUEST_DESC_HEADER_NAME]: requestDesc,
3131
},

pages/api/datasets/[id]/annorep/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
2424
params: {
2525
replace: true,
2626
},
27-
data: JSON.stringify({
27+
data: {
2828
[ANNOREP_METADATA_FIELD]: ANNOREP_METADATA_VALUE,
29-
}),
29+
},
3030
headers: {
31-
"Content-type": "application/json-ld", //TODO: change ld+json?
31+
"Content-Type": "application/json-ld", //TODO: change ld+json?
3232
[DATAVERSE_HEADER_NAME]: session.dataverseApiToken,
3333
[REQUEST_DESC_HEADER_NAME]: requestDesc,
3434
},

pages/api/hypothesis/[id]/export-annotations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
2727
return axiosClient.post(exportApiUrl, JSON.stringify(annotation.data), {
2828
headers: {
2929
Authorization: `Bearer ${exportApiToken}`,
30-
"Content-type": "application/json",
30+
"Content-Type": "application/json",
3131
[REQUEST_DESC_HEADER_NAME]: `Exporting annotation ${annotation.sourceId} to ${destinationUrl}`,
3232
},
3333
})

pages/api/hypothesis/[id]/title-annotation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
8989
{
9090
headers: {
9191
Authorization: `Bearer ${hypothesisApiToken}`,
92-
"Content-type": "application/json",
92+
"Content-Type": "application/json",
9393
[REQUEST_DESC_HEADER_NAME]: `Sending title annotation from source manuscript ${manuscriptId} to Hypothes.is server`,
9494
},
9595
}

utils/hypothesisUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ async function batchPostAnnotations({
344344
JSON.stringify(postData),
345345
{
346346
headers: {
347-
"Content-type": "application/json",
347+
"Content-Type": "application/json",
348348
},
349349
}
350350
)

0 commit comments

Comments
 (0)