RestRserve icon indicating copy to clipboard operation
RestRserve copied to clipboard

List somewhere that EncodeDecode middleware needs to be added in the last position after any other middleware.

Open duarteoctavio opened this issue 4 years ago • 1 comments
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!

duarteoctavio avatar Jun 09 '21 21:06 duarteoctavio

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.

dselivanov avatar Jun 11 '21 04:06 dselivanov