Skip to content

Axios-debug tries to stringify circular JSON #1

@dschuessler

Description

@dschuessler

I used axios-debug in an integration test and got this:

Request:
{
    "url": "http://localhost:8080/api/user/login/",
    "method": "post",
    "data": {
        "email": "test@test.com",
        "password": "***"
    },
    "headers": {
        "common": {
            "Accept": "application/json, text/plain, */*"
        },
        "delete": {},
        "get": {},
        "head": {},
        "post": {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        "put": {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        "patch": {
            "Content-Type": "application/x-www-form-urlencoded"
        }
    },
    "transformRequest": [
        null
    ],
    "transformResponse": [
        null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1
}
Response:
  1) "before all" hook in "{root}"

  0 passing (374ms)
  1 failing

  1) "before all" hook in "{root}":
     TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'Socket'
    --- property '_httpMessage' closes the circle
      at JSON.stringify (<anonymous>)
      at Object.debug (node_modules/axios-debug/lib/index.js:4:67)
      at /path/to/project/e2e-test/node_modules/axios-debug/lib/index.js:31:9
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

It seems like axios-debug does not expect circular JSON at certain points. Let me know if you are interested in more information:

axios: 0.19.2
axios-debug: 0.0.4
node: 13.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions