Skip to content

Commit

Permalink
Merge pull request #44 from supabase/fix/43_content_type_parser
Browse files Browse the repository at this point in the history
fix: #43 use custom content type parser for application/json and text/plain
  • Loading branch information
inian authored Jul 15, 2021
2 parents b543e92 + e3b8a0d commit 980e5c6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/routes/bucket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import updateBucket from './updateBucket'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default async function routes(fastify: FastifyInstance) {
createBucket(fastify)
deleteBucket(fastify)
emptyBucket(fastify)
getAllBuckets(fastify)
getBucket(fastify)
updateBucket(fastify)
fastify.register(createBucket)
fastify.register(deleteBucket)
fastify.register(emptyBucket)
fastify.register(getAllBuckets)
fastify.register(getBucket)
fastify.register(updateBucket)
}
7 changes: 7 additions & 0 deletions src/routes/object/createObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ export default async function routes(fastify: FastifyInstance) {
tags: ['object'],
})

fastify.addContentTypeParser(
['application/json', 'text/plain'],
function (request, payload, done) {
done(null)
}
)

fastify.post<createObjectRequestInterface>(
'/:bucketName/*',
{
Expand Down
22 changes: 11 additions & 11 deletions src/routes/object/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import updateObject from './updateObject'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default async function routes(fastify: FastifyInstance) {
copyObject(fastify)
createObject(fastify)
deleteObject(fastify)
deleteObjects(fastify)
getObject(fastify)
getSignedObject(fastify)
getPublicObject(fastify)
getSignedURL(fastify)
moveObject(fastify)
updateObject(fastify)
listObjects(fastify)
fastify.register(copyObject)
fastify.register(createObject)
fastify.register(deleteObject)
fastify.register(deleteObjects)
fastify.register(getObject)
fastify.register(getSignedObject)
fastify.register(getPublicObject)
fastify.register(getSignedURL)
fastify.register(moveObject)
fastify.register(updateObject)
fastify.register(listObjects)
}
8 changes: 8 additions & 0 deletions src/routes/object/updateObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export default async function routes(fastify: FastifyInstance) {
summary,
tags: ['object'],
})

fastify.addContentTypeParser(
['application/json', 'text/plain'],
function (request, payload, done) {
done(null)
}
)

fastify.put<updateObjectRequestInterface>(
'/:bucketName/*',
{
Expand Down

0 comments on commit 980e5c6

Please # to comment.