RestRserve
RestRserve copied to clipboard
List somewhere that EncodeDecode middleware needs to be added in the last position after any other middleware.
trafficstars
Situation
Perhaps I'm getting something wrong, but after I added CORS middleware to my app, it started getting raw data instead of the type indicadted in the header, until I added the EncodeDecode middleware to the list, with the empty (default) parameters. Then, it worked.
Example
app = RestRserve::Application$new(
content_type="application/json",
middleware = list(
CORSMiddleware$new(),
EncodeDecodeMiddleware$new()
),
)
Congratulations for coding this a amazing app!
Yes, default contsructor initialize EncodeDecodeMiddleware middleware. So when adding more than one you need to list all of them explicitly. May be we need to clarify this in docs.