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

Discuss: Decode json body with JSON logger? #21

Closed
icyleaf opened this issue Jul 3, 2018 · 1 comment
Closed

Discuss: Decode json body with JSON logger? #21

icyleaf opened this issue Jul 3, 2018 · 1 comment
Labels

Comments

@icyleaf
Copy link
Owner

icyleaf commented Jul 3, 2018

before:

{
  "created_at": "2018-07-03T10:48:04+08:00:00",
  "entry": {
    "request": {
      "body": "name=icyleaf",
      "headers": {
        "User-Agent": "Halite/0.4.0",
        "Accept": "*/*",
        "Connection": "keep-alive",
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "method": "POST",
      "url": "https://httpbin.org/post",
      "timestamp": "2018-07-03T10:48:05+08:00:00"
    },
    "response": {
      "body": "{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"name\":\"icyleaf\"},\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate\",\"Connection\":\"close\",\"Content-Length\":\"12\",\"Content-Type\":\"application/x-www-form-urlencoded\",\"Host\":\"httpbin.org\",\"User-Agent\":\"Halite/0.4.0\"},\"json\":null,\"origin\":\"60.206.194.34\",\"url\":\"https://httpbin.org/post\"}\n",
      "header": {
        "Connection": "keep-alive",
        "Server": "gunicorn/19.8.1",
        "Date": "Tue, 03 Jul 2018 02:48:05 GMT",
        "Content-Type": "application/json",
        "Content-Length": "333",
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": "true",
        "Via": "1.1 vegur"
      },
      "status_code": 200,
      "http_version": "HTTP/1.1",
      "timestamp": "2018-07-03T10:48:05+08:00:00"
    }
  }
}

after:

{
  "created_at": "2018-07-03T10:48:04+08:00:00",
  "entry": {
    "request": {
      "body": "name=icyleaf",
      "headers": {
        "User-Agent": "Halite/0.4.0",
        "Accept": "*/*",
        "Connection": "keep-alive",
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "method": "POST",
      "url": "https://httpbin.org/post",
      "timestamp": "2018-07-03T10:48:05+08:00:00"
    },
    "response": {
      "body": {
        "args": {},
        "data": "",
        "files": {},
        "form": {
          "name": "icyleaf"
        },
        "headers": {
          "Accept": "*/*",
          "Accept-Encoding": "gzip, deflate",
          "Connection": "close",
          "Content-Length": "12",
          "Content-Type": "application/x-www-form-urlencoded",
          "Host": "httpbin.org",
          "User-Agent": "Halite/0.4.0"
        },
        "json": null,
        "origin": "60.206.194.34",
        "url": "https://httpbin.org/post"
      },
      "header": {
        "Connection": "keep-alive",
        "Server": "gunicorn/19.8.1",
        "Date": "Tue, 03 Jul 2018 02:48:05 GMT",
        "Content-Type": "application/json",
        "Content-Length": "333",
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": "true",
        "Via": "1.1 vegur"
      },
      "status_code": 200,
      "http_version": "HTTP/1.1",
      "timestamp": "2018-07-03T10:48:05+08:00:00"
    }
  }
}
@icyleaf icyleaf changed the title Format json body with JSON logger Discuss: Decode json body with JSON logger? Jul 3, 2018
@icyleaf icyleaf added discuss and removed question labels Jul 3, 2018
@icyleaf
Copy link
Owner Author

icyleaf commented Jul 3, 2018

I thinks it's better to keep the raw string.

@icyleaf icyleaf closed this as completed Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant