Skip to content

Commit

Permalink
fix: IA API actually requires form body instead of query strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Sep 2, 2024
1 parent fca0b32 commit fbd6d80
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions src/util/__tests__/archiveUrlsFromText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,28 @@ describe('archiveUrlsFromText', () => {
expect(mockedFetch.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
"https://web.archive.org/save?url=https%3A%2F%2Fexample.com%2F&capture_screenshot=1&skip_first_archive=1&delay_wb_availability=1",
"https://web.archive.org/save",
Object {
"body": FormData {
Symbol(state): Array [
Object {
"name": "url",
"value": "https://example.com/",
},
Object {
"name": "capture_screenshot",
"value": "1",
},
Object {
"name": "skip_first_archive",
"value": "1",
},
Object {
"name": "delay_wb_availability",
"value": "1",
},
],
},
"headers": Object {
"Accept": "application/json",
"Authorization": "LOW test-access-key:test-secret",
Expand All @@ -88,8 +108,28 @@ describe('archiveUrlsFromText', () => {
},
],
Array [
"https://web.archive.org/save?url=https%3A%2F%2Fexample2.com%2F%3Ffoo%3Dbar&capture_screenshot=1&skip_first_archive=1&delay_wb_availability=1",
"https://web.archive.org/save",
Object {
"body": FormData {
Symbol(state): Array [
Object {
"name": "url",
"value": "https://example2.com/?foo=bar",
},
Object {
"name": "capture_screenshot",
"value": "1",
},
Object {
"name": "skip_first_archive",
"value": "1",
},
Object {
"name": "delay_wb_availability",
"value": "1",
},
],
},
"headers": Object {
"Accept": "application/json",
"Authorization": "LOW test-access-key:test-secret",
Expand Down

0 comments on commit fbd6d80

Please sign in to comment.