Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thoughts about HTTP layer

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Thoughts about HTTP layer

Avatar for Rostislav Zhuravsky

Rostislav Zhuravsky

December 06, 2021
Tweet

More Decks by Rostislav Zhuravsky

Other Decks in Programming

Transcript

  1. Adding a new request requires remembering about a lot of

    things: • Which statuses can be returned? • What errors can be thrown? • How to handle the errors? • What to do with a failed request? Retries?
  2. Our codebase is heavily glued to Faraday • What if

    Faraday API would be changed? • What if we would want to change the library? • What if we would need to fix/extend current implementation? • How to test it? Should we stub HTTP requests or mock objects?
  3. Our plan was • Look through all the places where

    Faraday is used • Collect all the features we need to implement in our wrapper • Replace step by step Faraday with our library using feature toggles
  4. Features we need to support • Retries • Follow redirects

    • Raise an error on failure • Notify to Bugsnag • Parallel execution • Configure timeouts • Different request/response data format
  5. Summary • Write a high-level abstractions which correspond to actual

    business rules • Isolate dependencies on gems/libs • Explicit is better than implicit a.k.a keep everything you can under your control • Write tests