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

Support for custom body parsers #389

Closed
Badgerati opened this issue Oct 6, 2019 · 0 comments · Fixed by #393
Closed

Support for custom body parsers #389

Badgerati opened this issue Oct 6, 2019 · 0 comments · Fixed by #393
Assignees
Milestone

Comments

@Badgerati
Copy link
Owner

Badgerati commented Oct 6, 2019

Describe the Feature

Currently when a body/payload is supplied to Pode, the inbuilt parsers are XML, CSV, JSON, Form, and MultiForm.

It would be nice to support custom parsers - to not only add parsers for new content type, but also override the inbuilt ones.

Add-PodeBodyParser -ContentType 'text/yaml' -ScriptBlock {
    param($body)

    # some logic to parse it

    return $parsed_body
}

plus a:

Remove-PodeBodyParser -ContentType 'text/yaml'

So just before the ConvertFrom-PodeRequestContent internal function is about to parse, it checks some map of custom parsers for the content type first.

Additional Context

This could to open the way for Pode extensions - like a Pode-Yaml parser, etc.

@Badgerati Badgerati self-assigned this Oct 7, 2019
Badgerati added a commit that referenced this issue Oct 8, 2019
@Badgerati Badgerati added this to the 1.2.0 milestone Oct 8, 2019
Badgerati added a commit that referenced this issue Oct 8, 2019
Badgerati added a commit that referenced this issue Oct 8, 2019
Badgerati added a commit that referenced this issue Oct 9, 2019
#389: Adds new functions to allow adding of custom body parsers
@Badgerati Badgerati mentioned this issue Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant