-
Notifications
You must be signed in to change notification settings - Fork 66
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
Logical error for response processing #95
base: main
Are you sure you want to change the base?
Conversation
My case: Result return "" for #errors when DELETE method responded with no body(204 status). Problem HashWithIndifferentAccess.new pass first argument to Hash.new that recognize it as default value for all keys. This happen when body don't repond to #to_hash
@ASnow usually I will handle this at the faraday layer, as the problems that occur can differ from each user. You can massage the returned body in anyway you want here, so that eventually is follows this format before being passed on to Spyke: { data: { id: 1, name: 'Bob' }, metadata: {}, errors: {} } |
@balvig, please look at Faraday default handling process It don't run parse in middleware for such case |
@ASnow you could add some middleware before that, that gets rid of blank strings, or even flesh out your own JSONParser middleware to come up with your own definition of when |
@balvig, yep I can. Is it ok that Result handles well(silent) when get not Hash? |
@ASnow sorry, I couldn't quite catch what you mean by this question? |
I can describe two possible solutions for current situation.
|
@ASnow could you try showing a higher level test, for example based on a |
dac98fe
to
5fa3e00
Compare
My case:
Result return "" for #errors when DELETE method responded with no body(204 status).
Problem
HashWithIndifferentAccess.new pass first argument to Hash.new that recognize it as default value for all keys. This happen when body don't repond to #to_hash