Related: #470, elixir-plug/plug#925
I apologize for the title, I'm not sure exactly what this should be called.
I have an endpoint that needs to receive non-UTF-8 query params. Thankfully, there is the validate_utf8: false option that I can set on Plug.Parsers, so thank you for that.
However, I get errors like [debug] ** (Plug.Conn.InvalidQueryError) invalid UTF-8 on urlencoded params, got byte 159 when the Phoenix.LiveDashboard.RequestLogger plug is enabled, even when Plug.Parsers validate_utf8 is set to false.
When enabled in Phoenix's endpoint.ex (which it is by default), the Phoenix.LiveDashboard.RequestLogger plug appears to call Plug.Conn.fetch_query_params/2 with the default options here, which have validate_utf8 set to true.
I can confirm that commenting out the Phoenix.LiveDashboard.RequestLogger plug causes the plug stack to no longer raise, so this is not a big deal, but I'm just reporting this because this may be slightly confusing to others who set Plug.Parsers validate_utf8: false and then continue to see the exception. I know this confused me: I set validate_utf8: false and my endpoint continued to crash for requests that had non-UTF-8 data, until I dug into the stack trace and saw that it wasn't coming from Plug.Parsers but was coming from Phoenix.LiveDashboard.RequestLogger.
Thank you!
Related: #470, elixir-plug/plug#925
I apologize for the title, I'm not sure exactly what this should be called.
I have an endpoint that needs to receive non-UTF-8 query params. Thankfully, there is the
validate_utf8: falseoption that I can set onPlug.Parsers, so thank you for that.However, I get errors like
[debug] ** (Plug.Conn.InvalidQueryError) invalid UTF-8 on urlencoded params, got byte 159when thePhoenix.LiveDashboard.RequestLoggerplug is enabled, even whenPlug.Parsersvalidate_utf8is set tofalse.When enabled in Phoenix's
endpoint.ex(which it is by default), thePhoenix.LiveDashboard.RequestLoggerplug appears to callPlug.Conn.fetch_query_params/2with the default options here, which havevalidate_utf8set totrue.I can confirm that commenting out the
Phoenix.LiveDashboard.RequestLoggerplug causes the plug stack to no longer raise, so this is not a big deal, but I'm just reporting this because this may be slightly confusing to others who setPlug.Parsersvalidate_utf8: falseand then continue to see the exception. I know this confused me: I setvalidate_utf8: falseand my endpoint continued to crash for requests that had non-UTF-8 data, until I dug into the stack trace and saw that it wasn't coming fromPlug.Parsersbut was coming fromPhoenix.LiveDashboard.RequestLogger.Thank you!