-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Question: Body-Parser #672
Comments
Ok, after reading Docs again and searching through the Source-Code if found that there are inbuilt parsers - so I was just wondering now, why my body does not get parsed. I returned in my route the Request-Object as a Json-Response and found, that there is the Content-Type field empty. I am still investigating, why in my setup (involving a custom reverse proxy) Pode does not get the Content-Type (the Browser sends it) |
After reading Docs again, and searching to the code again, I feel quite stupid - I was missing the ContentType Parameter in my route definition. So I am closing this :) |
Hey, Yes you're right, Pode does have inbuilt body parsing middleware for the more common types: JSON, XML, and Forms. The parsing is chosen based on the If the |
Thank you for your answer, with that additional Content-Type Parameter it works like a charm. I dug a little bit deeper: As for my unterstanding is, that the .net Hashtable (used in PodeHttpRequest.cs) is case sensitve, but HTTP-headernames should be case insensitive. A possible solution could be to set the compare-function on the hashtable like mentioned on this SO-Post: https://stackoverflow.com/questions/856989/using-hashtables-dictionaries-with-string-keys-case-insensitive-searching |
Oh wow, good spot! Too used to PowerShell's Hashtables 🙈 |
Hi,
I do not unterstand fully the concept of the Body-Parser-Middleware and their activation on a specific Route.
Are there any Built-In Body-Parsers (for JSON or Form-Data) in Pode 2.0.3? I looked through the source, but got lost :)
I unterstand, that I can implement Body-Parsers per Content-Type by myself - but I wanted to ask before I dig into that.
I tried it to test it with a simple Route, which gets its data (phone=680+12345678) from a Post from an HTML-From with Content-Type 'application/x-www-form-urlencoded':
Add-PodeRoute -Method Post -Path "2fa" -ScriptBlock { Write-PodeJsonResponse -Value @{ 'Data' = $WebEvent.Data } }
thanks in advance
The text was updated successfully, but these errors were encountered: