Skip to content

Conversation

@madejejej
Copy link
Contributor

@madejejej madejejej commented Sep 8, 2023

Faraday middlewares are being called in reverse order.

With the current ordering, you might get a successful (200) response from Clickhouse with an expected content type (application/json), but the response body might contain an error message. This will cause ClickHouse to raise a JSON::ParserError or Oj::ParserError instead of a DbException.

We need to reverse the middleware order to check the response status first and only then attempt to parse the body.

@madejejej madejejej force-pushed the proper-middleware-order branch from a7f27b3 to 617ceb7 Compare September 8, 2023 10:46
@madejejej madejejej changed the title Put parser middlewares in the beginning of the middleware chain Put RaiseError middleware at the end of the middleware chain Sep 8, 2023
@serg-kovalev
Copy link

@shlima can you please take a look on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants