-
I'm creating an UserScript which will sort the feeds alphabetically for me. fetch(window.location.origin + '/rest/feed/import', {
method : "POST",
headers: { 'Content-Type': 'multipart/form-data' },
body: new XMLSerializer().serializeToString(opml),
}).then(res => res.text()).then(console.log); but I'm getting Adding header |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to post a
opmlFile is usually the value from the file picker but it seems you have the opml as xml or string. I think you'd need to construct a File yourself then: https://stackoverflow.com/a/26181292 After that you can set See commafeed/commafeed-client/src/app/client.ts Lines 63 to 72 in 3271d69 |
Beta Was this translation helpful? Give feedback.
You need to post a
FormData
object and set thefile
param to the opml content.file
is the name expected by CommaFeed for the opml in the POST body.opmlFile is usually the value from the file picker but it seems you have the opml as xml or string. I think you'd need to construct a File yourself then: https://stackoverflow.com/a/26181292
After that you can set
formData
as the value forbody
in yourfetch
:body: formData
.See
commafeed/commafeed-client/src/app/client.ts
Lines 63 to 72 in 3271d69