Fetch Headers and Why They Matter

  Рет қаралды 8,677

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

Күн бұрын

If you have ever used fetch or XMLHttpRequest then you have worked with HTTP Requests and HTTP Responses. That also means that you have been working with Headers, which are an integral part of every Request and Response.
This tutorial explains how you can find the headers, their values, and then use that as part of your fetch process.
Code from Video: gist.github.co...
MDN reference for the Headers object: developer.mozi...

Пікірлер: 27
@Gollumfili
@Gollumfili 3 жыл бұрын
Love how these videos are kept as simple as possible, but are still explained properly without all the waffle. Definitely my go to channel.
@codesader
@codesader 3 жыл бұрын
This is powerful. I have always known there was more to the headers. I just didn't know it was this much. I bet this is just even a tip of the iceberg. Great content!
@biswamohandwari6460
@biswamohandwari6460 3 жыл бұрын
Everytime I visit this channel I always find something which I don't know and then starts to learn it🙂
@paxdriver
@paxdriver 3 жыл бұрын
Correction, I think important for newbies: arrays are not key-value pairs, an array is an ordered list aka index-value pairs (arrays don't have named keys like objects do). Good vids, love your work, thanks a mil 👍
@reanibutani9555
@reanibutani9555 3 жыл бұрын
This is the best explaination about headers
@ShreyasKumar
@ShreyasKumar 2 жыл бұрын
Love you Steve you are a true GEM. Thank you for your lovely tutorials. 🙂
@barungh
@barungh 2 жыл бұрын
Thanks!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Thank you very much! Again.
@deependrasinghshekhawat2856
@deependrasinghshekhawat2856 3 жыл бұрын
I came in to learn something and with that learned something else as well. thanks as always.
@barungh
@barungh 2 жыл бұрын
Very very useful, I was looking into 'Lorem Picsum' - Rndom Image Generator API, and wanted to control the response Thank You so much.
@oussamasethoum1665
@oussamasethoum1665 2 жыл бұрын
why tutorials doesn't touch the necessary part which is setting the headers in the request.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
like this? - kzbin.info/www/bejne/j3uai5p9o82Ba80
@armin3529
@armin3529 3 жыл бұрын
That's us great man thanks ❤️❤️❤️
@tralalili_dwarf
@tralalili_dwarf 3 жыл бұрын
i'm sorry but something is confusing me in the code. but it's not realy related to the vid. how does a for of loop work with resp.headers if resp.headers is an object? doesn't a for of loop only works with itterables?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
The headers object itself is iterable. It works the exact same way as if you used for( let entry of myHeaders.entries() ){ } developer.mozilla.org/en-US/docs/Web/API/Headers/entries
@tralalili_dwarf
@tralalili_dwarf 3 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 I really appreciate the quick answer, steve. it helped a lot. thank you very much, i love your channel !!
@pjmclenon
@pjmclenon 2 жыл бұрын
hello this does not work on a mobile or even any phone wifi for json why?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Most likely you are missing the response header from the server. The client side code should work everywhere.
@pjmclenon
@pjmclenon 2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 hello i tried many differnt lines of code and it never worked Lisa
@devstefancho
@devstefancho 3 жыл бұрын
awesome!
@whyredvince
@whyredvince 3 жыл бұрын
You should start a blog.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
Here ya go - dev.to/prof3ssorst3v3/you-can-convert-your-callbacks-to-promises-141n
@joaovaz3473
@joaovaz3473 3 жыл бұрын
I'll be honest: I know nothing about headers except for what they are (I'd say some kind of array of information that's returned with a file) lmao
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
That is actually a pretty good description. When you send an HTTP request it has a header, body, and footer. The HTTP response also has those three things. the body is where the uploaded or downloaded file (or formatted data) goes. The header is the description of where it is going, where it came from, and other meta information. The footer is for verifying that you have the whole thing.
@senseicodes
@senseicodes 3 жыл бұрын
First viewer😁
@rajkumarvelumani6283
@rajkumarvelumani6283 3 жыл бұрын
Hi bro.. How to fetch single data from database using JavaScript Make a video for this
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
I released a whole playlist on IndexedDB with JS last week
How to Determine Remote Filesizes without Downloading Files
11:36
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 2,2 М.
Ten Steps to Mastering the Fetch API
2:19:52
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 51 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
JavaScript Fetch with Request and Headers Objects
16:26
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 65 М.
Console is More Than Just log
11:16
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 4,9 М.
HTTP Headers & Methods - Rest APIs In Depth
33:37
Tech with Nader
Рет қаралды 3,5 М.
Using FormData Objects Effectively
13:14
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 37 М.
Request Headers for Web Scraping
10:03
John Watson Rooney
Рет қаралды 47 М.
Deep Dive into Blobs, Files, and ArrayBuffers
17:42
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 39 М.
Sending JavaScript Http Requests with XMLHttpRequest
18:53
Academind
Рет қаралды 215 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН