-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When posting to an external blog, the selected categories are sent to the Micropub server using an unrecognised key name, category[] instead of category.
This is the data sent to a server by the Micro.blog app:
{
h: 'entry',
content: 'Test categories',
'category[]': [ 'indiekit', 'indieweb' ],
'mp-destination': 'https://indiekit-sandbox.netlify.app'/,
}However, sending the same data from another app (such as Quill) will send the following data:
{
h: 'entry',
content: 'Test categories',
category: [ 'indiekit', 'indieweb' ],
}It looks like the app appends categories to a category[] field:
microblog-react/src/api/MicroPubApi.js
Line 170 in 5006bdc
| params.append('category[]', category) |
Using URLSearchParams.append() method multiple times adds the key value pair to a URL multiple times:
let url = new URL("https://website.example");
url.searchParams.append("category", "foo")
url.searchParams.append("category", "bar")
console.log("url", url)
// https://website.example/?category=foo&category=barMultiple params with the same key name get serialised as an Array, so there’s no need to indicate the field is an array by adding a [] suffix. That’s my understanding, anyway.
Metadata
Metadata
Assignees
Labels
No labels