Skip to content

Commit

Permalink
bugfix/axios-error (#166)
Browse files Browse the repository at this point in the history
* Upgrade axios to 0.21.4

* Don't pre-stringified json-ld
tohuynh authored Mar 21, 2024
1 parent 4344c94 commit 87824fc
Showing 9 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion features/ati/AtiExportAnnotations/index.tsx
Original file line number Diff line number Diff line change
@@ -187,7 +187,7 @@ const AtiExportAnnotations: FC<AtiExportAnnotationstProps> = ({
}),
{
headers: {
"Content-type": "application/json",
"Content-Type": "application/json",
},
}
)
30 changes: 19 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@
"@prisma/client": "^2.27.0",
"@types/carbon-components-react": "^7.44.0",
"@types/carbon__icons-react": "^10.31.2",
"axios": "^0.21.2",
"axios": "^0.21.4",
"axios-retry": "^3.2.4",
"carbon-components": "^10.45.0",
"carbon-components-react": "^7.45.0",
2 changes: 1 addition & 1 deletion pages/api/arcore/[id]/index.ts
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
headers: {
Authorization: `Bearer ${hypothesisApiToken}`,
"Content-type": "application/json",
"Content-Type": "application/json",
[REQUEST_DESC_HEADER_NAME]: `Sending annotations from source manuscript ${id} to Hypothes.is server`,
},
}
6 changes: 3 additions & 3 deletions pages/api/datasets/[id]/annorep/delete.ts
Original file line number Diff line number Diff line change
@@ -21,11 +21,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const { status, data } = await axiosClient({
method: "PUT",
url: `${process.env.DATAVERSE_SERVER_URL}/api/datasets/${id}/metadata/delete`,
data: JSON.stringify({
data: {
[ANNOREP_METADATA_FIELD]: ANNOREP_METADATA_VALUE,
}),
},
headers: {
"Content-type": "application/json-ld", //TODO: change ld+json?
"Content-Type": "application/json-ld", //TODO: change ld+json?
[DATAVERSE_HEADER_NAME]: session.dataverseApiToken,
[REQUEST_DESC_HEADER_NAME]: requestDesc,
},
6 changes: 3 additions & 3 deletions pages/api/datasets/[id]/annorep/index.ts
Original file line number Diff line number Diff line change
@@ -24,11 +24,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
params: {
replace: true,
},
data: JSON.stringify({
data: {
[ANNOREP_METADATA_FIELD]: ANNOREP_METADATA_VALUE,
}),
},
headers: {
"Content-type": "application/json-ld", //TODO: change ld+json?
"Content-Type": "application/json-ld", //TODO: change ld+json?
[DATAVERSE_HEADER_NAME]: session.dataverseApiToken,
[REQUEST_DESC_HEADER_NAME]: requestDesc,
},
2 changes: 1 addition & 1 deletion pages/api/hypothesis/[id]/export-annotations.ts
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return axiosClient.post(exportApiUrl, JSON.stringify(annotation.data), {
headers: {
Authorization: `Bearer ${exportApiToken}`,
"Content-type": "application/json",
"Content-Type": "application/json",
[REQUEST_DESC_HEADER_NAME]: `Exporting annotation ${annotation.sourceId} to ${destinationUrl}`,
},
})
2 changes: 1 addition & 1 deletion pages/api/hypothesis/[id]/title-annotation.ts
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
headers: {
Authorization: `Bearer ${hypothesisApiToken}`,
"Content-type": "application/json",
"Content-Type": "application/json",
[REQUEST_DESC_HEADER_NAME]: `Sending title annotation from source manuscript ${manuscriptId} to Hypothes.is server`,
},
}
2 changes: 1 addition & 1 deletion utils/hypothesisUtils.ts
Original file line number Diff line number Diff line change
@@ -344,7 +344,7 @@ async function batchPostAnnotations({
JSON.stringify(postData),
{
headers: {
"Content-type": "application/json",
"Content-Type": "application/json",
},
}
)

0 comments on commit 87824fc

Please sign in to comment.