mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 12:23:09 +02:00
add: x-www-form-urlencoded parser
This commit is contained in:
parent
4d3dee7022
commit
96180bb808
1 changed files with 10 additions and 0 deletions
|
@ -45,6 +45,16 @@ export class MastodonApiServerService {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fastify.addContentTypeParser(['application/x-www-form-urlencoded'], { parseAs: 'string' }, function (req, body, done) {
|
||||||
|
const dataObj = {};
|
||||||
|
const parsedData = new URLSearchParams(body as string);
|
||||||
|
for (var pair of parsedData.entries()) {
|
||||||
|
//@ts-ignore
|
||||||
|
dataObj[pair[0]] = pair[1];
|
||||||
|
}
|
||||||
|
done(null, dataObj)
|
||||||
|
});
|
||||||
|
|
||||||
fastify.register(multer.contentParser);
|
fastify.register(multer.contentParser);
|
||||||
|
|
||||||
fastify.get('/v1/custom_emojis', async (_request, reply) => {
|
fastify.get('/v1/custom_emojis', async (_request, reply) => {
|
||||||
|
|
Loading…
Reference in a new issue