Skip to content

How to access response object when there is no error #1693

Answered by dagadbm
dagadbm asked this question in Q&A
Discussion options

You must be logged in to vote

pasting here my final version of the code (js only)

import {
  make,
  filter,
  merge,
  mergeMap,
  pipe,
  share,
  takeUntil,
  onPush,
} from 'wonka';

import {
  makeFetchBody,
  makeFetchURL,
  makeFetchOptions,
} from '@urql/core/internal';

import { makeResult, makeErrorResult } from '@urql/core';

const executeFetch = (
  operation,
  url,
  fetchOptions,
) => {
  const fetcher = operation.context.fetch;

  let statusNotOk = false;
  let response;
  let requestId;

  return (fetcher || fetch)(url, fetchOptions)
    .then((res) => {
      statusNotOk = res.status < 200
        || res.status >= (fetchOptions.redirect === 'manual' ? 400 : 300);
      response = res;
      requestId = 

Replies: 3 comments 16 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
16 replies
@dagadbm
Comment options

@JoviDeCroock
Comment options

@dagadbm
Comment options

@kitten
Comment options

@dagadbm
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dagadbm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants