Back to Browse

Retrofit Tutorial Part 6 - HOW TO ADD HEADERS - Android Studio Tutorial

56.2K views
Feb 7, 2019
7:57

In part 6 of the Retrofit tutorial, we will learn how to add headers to our HTTP requests. HTTP headers contain the metadata for each request and response, like the content-type of the body, the expiration date, or an authentication token. We can add headers with Retrofit to HTTP methods either statically, by adding the @Headers annotation and defining the headers hardcoded as strings, or dynamically, by passing @Header or @HeaderMap annotated arguments. Alternatively, we can add headers to all methods at once using an OkHttp Interceptor. Watch the whole playlist: https://www.youtube.com/playlist?list=PLrnPJCHvNZuCbuD3xpfKzQWOj3AXybSaM Example code for this part: https://gist.github.com/codinginflow/3f8719d1b971fd9ef24f096f5696d1fd ____________________ 💻 Find the BEST programming tutorials on TutHub: https://tuthub.io ⭐ Get my MVVM Caching Course now: https://codinginflow.com/caching ❗ Subscribe to the channel: https://www.youtube.com/c/codinginflo... 📨 Subscribe to the Coding in Flow newsletter: https://codinginflow.com/newsletter ❓ Join our free developer community: https://discord.gg/TSnMvmc 📣 Follow Coding in Flow on other sites: Facebook: https://www.facebook.com/codinginflow Instagram: https://www.instagram.com/codinginflow TikTok: https://www.tiktok.com/@codinginflow Twitter: https://twitter.com/codinginflow Github: https://github.com/codinginflow 💰 Business requests, sponsoring, etc.: [email protected]

Download

1 formats

Video Formats

360pmp417.5 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Retrofit Tutorial Part 6 - HOW TO ADD HEADERS - Android Studio Tutorial | NatokHD