Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add customize content type parsers for api plugin #10449

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

scott1028
Copy link

@scott1028 scott1028 commented Apr 13, 2024

This PR allows users to extend supported contentType for native API plugin.
I follow https://redwoodjs.com/docs/docker#using-the-server-file, but it doesn't work.

    ...
  await server.register(redwoodFastifyAPI, {          <-- work after remove "await"
    redwood: {
      apiRootPath,
      fastGlobOptions: {
        ignore: ['**/dist/functions/graphql.js'],
      },
    },
  })
   ...

  // This doesn't work after a "await server.register(...)"
  server.addContentTypeParser('text/csv', { parseAs: 'string' }, (request, body, done) => {
    const csvData = body.split('\n').map(row => row.split(','))
    done(null, csvData)
  })

@scott1028 scott1028 force-pushed the add-fastify-custom-add-content-type-parsers branch 3 times, most recently from cd7825f to 56abbb8 Compare April 13, 2024 03:25
@scott1028 scott1028 changed the title WIP: feat: add customize content type parsers for api plugin feat: add customize content type parsers for api plugin Apr 13, 2024
@scott1028 scott1028 closed this Apr 13, 2024
@scott1028 scott1028 reopened this Apr 13, 2024
@scott1028 scott1028 changed the title feat: add customize content type parsers for api plugin WIP: feat: add customize content type parsers for api plugin Apr 13, 2024
@scott1028 scott1028 changed the title WIP: feat: add customize content type parsers for api plugin feat: add customize content type parsers for api plugin Apr 13, 2024
@scott1028 scott1028 force-pushed the add-fastify-custom-add-content-type-parsers branch 2 times, most recently from f5d6234 to f609745 Compare April 14, 2024 16:51
@scott1028 scott1028 force-pushed the add-fastify-custom-add-content-type-parsers branch from f609745 to ae0e572 Compare April 14, 2024 16:52
@scott1028 scott1028 force-pushed the add-fastify-custom-add-content-type-parsers branch from 60a680e to 7d608a2 Compare April 14, 2024 17:19
@thedavidprice thedavidprice added the contributor-pr Use to automatically add PRs to the "Contributor PRs" Project Board label May 1, 2024
@Tobbe
Copy link
Member

Tobbe commented May 1, 2024

Thanks for your PR @scott1028 I'm sorry no one got back to you sooner. We'll discuss this internally and see who can help move this forward

@scott1028
Copy link
Author

Thanks for your PR @scott1028 I'm sorry no one got back to you sooner. We'll discuss this internally and see who can help move this forward

Thanks for your reply :)

@Tobbe
Copy link
Member

Tobbe commented May 2, 2024

@scott1028 I found someone who can look into this. He's busy with other things right now, but will get to this when he has some more time available

@Josh-Walker-GM
Copy link
Collaborator

Hey @scott1028 👋 Again sorry for the radio silence on this. I'll get to this one in the next day or two

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor-pr Use to automatically add PRs to the "Contributor PRs" Project Board
Projects
Status: Ready
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants