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

Set Content-Type of request body #634

Open
tialki opened this issue May 12, 2024 · 0 comments
Open

Set Content-Type of request body #634

tialki opened this issue May 12, 2024 · 0 comments
Labels
enhancement New feature or request feature request

Comments

@tialki
Copy link

tialki commented May 12, 2024

What is the problem this feature would solve?

  • Set Content-Type of request body

What is the feature you are proposing to solve the problem?

new Elysia()
  .parser('application/json-patch+json', ({ request }) => request.json())
  .patch('/movies', () => {}, {
    body: t.Array(
      t.Union([
        t.Object({
          op: t.Union([t.Literal('test'), t.Literal('replace'), t.Literal('add')], {
            description: 'test | replace',
          }),
          path: t.String(),
          value: t.Any(),
        }),
        t.Object({
          op: t.Literal('remove', {
            description: 'remove',
          }),
          path: t.String(),
        }),
        t.Object({
          op: t.Union([t.Literal('move'), t.Literal('copy')], {
            description: 'move | copy',
          }),
          from: t.String(),
          path: t.String(),
        }),
      ])
    ),
    requestBodyType: 'application/json-patch+json'
  })

What alternatives have you considered?

No response

@tialki tialki added the enhancement New feature or request label May 12, 2024
@tialki tialki changed the title Custom ContentType and parser method Set Content-Type of request body May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request
Projects
None yet
Development

No branches or pull requests

2 participants