Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web specs better util.inspect output #2917

Closed
4 tasks done
KhafraDev opened this issue Mar 4, 2024 · 4 comments
Closed
4 tasks done

web specs better util.inspect output #2917

KhafraDev opened this issue Mar 4, 2024 · 4 comments
Labels
enhancement New feature or request fetch good first issue Good for newcomers

Comments

@KhafraDev
Copy link
Member

KhafraDev commented Mar 4, 2024

Example console output:

> new Response(null)
Response {
  [Symbol(realm)]: { settingsObject: {} },
  [Symbol(state)]: {
    aborted: false,
    rangeRequested: false,
    timingAllowPassed: false,
    requestIncludesCredentials: false,
    type: 'default',
    status: 200,
    timingInfo: null,
    cacheState: '',
    statusText: '',
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: Map(0) {},
      [Symbol(headers map sorted)]: null
    },
    urlList: []
  },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(0) {},
    [Symbol(headers map sorted)]: null
  }
}

> new Headers()
HeadersList {
  cookies: null,
  [Symbol(headers map)]: Map(0) {},
  [Symbol(headers map sorted)]: null
}

> new Request('http://a')
Request {
  [Symbol(realm)]: {
    settingsObject: { baseUrl: undefined, origin: [Getter], policyContainer: [Object] }
  },
  [Symbol(state)]: {
    method: 'GET',
    localURLsOnly: false,
    unsafeRequest: false,
    body: null,
    client: { baseUrl: undefined, origin: [Getter], policyContainer: [Object] },
    reservedClient: null,
    replacesClientId: '',
    window: 'client',
    keepalive: false,
    serviceWorkers: 'all',
    initiator: '',
    destination: '',
    priority: null,
    origin: 'client',
    policyContainer: 'client',
    referrer: 'client',
    referrerPolicy: '',
    mode: 'cors',
    useCORSPreflightFlag: false,
    credentials: 'same-origin',
    useCredentials: false,
    cache: 'default',
    redirect: 'follow',
    integrity: '',
    cryptoGraphicsNonceMetadata: '',
    parserMetadata: '',
    reloadNavigation: false,
    historyNavigation: false,
    userActivation: false,
    taintedOrigin: false,
    redirectCount: 0,
    responseTainting: 'basic',
    preventNoCacheCacheControlHeaderModification: false,
    done: false,
    timingAllowFailed: false,
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: Map(0) {},
      [Symbol(headers map sorted)]: null
    },
    urlList: [ [URL] ],
    url: URL {
      href: 'http://a/',
      origin: 'http://a',
      protocol: 'http:',
      username: '',
      password: '',
      host: 'a',
      hostname: 'a',
      port: '',
      pathname: '/',
      search: '',
      searchParams: URLSearchParams {},
      hash: ''
    }
  },
  [Symbol(signal)]: AbortSignal { aborted: false },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(0) {},
    [Symbol(headers map sorted)]: null
  }
}

> a = new FormData()
FormData { [Symbol(state)]: [] }
> a.append('a', 'b')
undefined
> a
FormData { [Symbol(state)]: [ { name: 'a', value: 'b' } ] }

It's pretty bad. A lot of internal implementation specifics are exposed and not too much useful information. Headers inspects its own HeadersList so it doesn't even say Headers { ... }.

  • Headers
  • FormData
  • Response
  • Request
@KhafraDev KhafraDev added enhancement New feature or request good first issue Good for newcomers fetch labels Mar 4, 2024
@BenzeneAlcohol
Copy link

I would like to take this up if no one is working on this issue.

@metcoder95
Copy link
Member

Do not forget to add tests 🙂

@mertcanaltin
Copy link
Member

I think we can close this place @KhafraDev

@Uzlopak
Copy link
Contributor

Uzlopak commented Mar 14, 2024

Beautiful ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fetch good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants