why 401 status code doesn't trigger `response.ok` to be false?

hi, i think this is a misunderstanding of the fetch API. Is response.ok a boolean to validate if the request was succesfull or to validate if the request was sent successfully?
3 Replies
Alex
Alex3mo ago
The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not. https://developer.mozilla.org/en-US/docs/Web/API/Response/ok
MDN Web Docs
Response: ok property - Web APIs | MDN
The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
Alex
Alex3mo ago
A 401 should return ok=false
Huilen
Huilen3mo ago
oh i was getting a ok=true on a 401 thats weird
Want results from more Discord servers?
Add your server
More Posts
Maybe i am dumb, but how can i detect if dynamically component has loaded or loading.js have closed?Can not figure it out. By loading.js i mean loading.tsx in app folder.typescript globals: @types/web overrides fetchHey all I have a pnpm monorepo with a couple of packages and two next apps. In the next apps 'windowcan anyone recommend a library to use mutating operations but return new unmutated objects?the best I can think of is immutable.js but I was wondering if anything better is available. I'd ratDrizzle, Neon, Vercel deployment configHi everyone, I'm starting a project with the T3 stack and I was wondering, how would I set up VercelReact, SASS, tsup and not loading component stylesHi guys, anyone with experience using tsup and scss? I have a work React library codebase that useBuilding an application with multiple logged in accounts and multiple workspaces per accountMy web app requires the ability to be logged into multiple accounts and the ability to have multiplePrisma migrate deploy docker optimization/improvementHeyo, I am currently creating an app with t3 app and using prisma and postgres for the database. Alstrying add variable for dark mode with prefered theme and "dark" class.qCurrently what I am doing is using declaring same variable twice for each condition can i do this beIncrease execution duration T3 w/ TRPCHow do I increase the execution limit so it doesn't time out at 10 seconds. I am using TRPC and the NextAuth Session Typescript checksMy project uses : tRPC, NextJS page router, NextAuth (T3 stack), RecoilJS (state management) In my c