-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
✨ add feature parse content-type application/x-ndjson #2645
Conversation
@ReneWerner87 I feel like this should be something in |
cool would be a plugin system where we could declare a parser for the content type in a map, then you could add these parsers separately and only the core parsers are included pseudocode app.bodyParser["application/x-www-form-urlencoded"] = formDataParserClosure like express with the bodyParser |
@huykn @ReneWerner87 @efectn According to this article you can already parse ndjson using native Go. https://abhinavg.net/2020/07/02/parse-ndjson/ decoder := json.NewDecoder(src)
for decoder.More() {
var order Order
if err := decoder.Decode(&order); err != nil {
return fmt.Errorf("parse order: %w", err)
}
fmt.Println(order)
} |
@gaby i think we have custom config apply for use 3rd json at: https://github.com/gofiber/fiber/blob/master/docs/guide/faster-fiber.md |
I tested this and it was not working |
for feature in this merge request or smt? |
Feature is working |
do you think this feature should be merged or not? or do we need to change to add parsers separately and only the core parsers are included? |
Good question, we will discuss it and then decide (unfortunately not everyone is here right now) |
sorry for the late reply because we can't possibly have parsers in the core for all content types that exist in v3 we can try to find a way to add parser from outside and in the code we can have a default parser for this in a separate folder or through additional packages from the contrib package or we add functionality externally that makes it easier to write custom parsing externally you are welcome to support us in v3 with a proposal |
Description
add feature parse content-type application/x-ndjson
ex input body json
expect return array via call method BodyParser
Type of change
Please delete options that are not relevant.
Checklist:
Commit formatting:
Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/