0

I am sending the following request to the server from my Angular file. Can this be accessed from my typescript file (preferably using a HttpClient object) ?

IncomingMessage {

  ...

  headers: {

    host: 'localhost:8080',

    connection: 'keep-alive',

    accept: 'application/json, text/plain, */*',

    'content-type': 'application/json',

    'sec-fetch-site': 'same-origin',

    'sec-fetch-mode': 'cors',

    'accept-encoding': 'gzip, deflate, br',

    'accept-language': 'en-US,en;q=0.9',

    cookie: '_iAToken=<cookie>'

  },

  ...

  url: '/teradata/databases/view/djfg',

  method: 'GET',

  baseUrl: '/api',

  originalUrl: '/api/teradata/databases/view/djfg',

  params: { '0': 'teradata/databases/view/djfg' },

  secret: '<secret>',

  cookies: {},

  signedCookies: [Object: null prototype] {

    _iAToken: '<token>'

  },

  _parsedOriginalUrl: Url {

    protocol: null,

    slashes: null,

    auth: null,

    host: null,

    port: null,

    hostname: null,

    hash: null,

    search: null,

    query: null,

    pathname: '/api/teradata/databases/view/djfg',

    path: '/api/teradata/databases/view/djfg',

    href: '/api/teradata/databases/view/djfg',

    _raw: '/api/teradata/databases/view/djfg'

  },

  session: Session {

    cookie: {

      path: '/',

      _expires: 2021-08-29T22:01:49.960Z,

      originalMaxAge: 544320000,

      httpOnly: true,

      secure: true

    },

    accessToken: '<access_token>',

    tokenset: {

      access_token: '<access_token>',

      token_type: 'Bearer',

      expires_at: 1629737347

    }

  },

}

I am making a call to an API in the backend and I wanted to check if this message is being sent when I make the call. So, I wanted to know if it can accessed using HttpClient object.

kian
  • 1,449
  • 2
  • 13
  • 21
Wolvie123
  • 1
  • 1
  • You're sending an http request to a server and you want to make sure that you've sent a request to this server? Maybe you should check this question https://stackoverflow.com/questions/46019771/catching-errors-in-angular-httpclient – New Rhino Oct 17 '21 at 00:42
  • The issue is that when I make an API call, I can't find this message in the request body in Java. But I can see that the request contains this message from the client side (in Angular) – Wolvie123 Oct 17 '21 at 01:34
  • Does this answer your question? [How can I view HTTP headers in Google Chrome?](https://stackoverflow.com/questions/4423061/how-can-i-view-http-headers-in-google-chrome) – kian Oct 17 '21 at 08:25
  • I am able to print it on the chrome console. I wanted to know if it was possible to send this message to the logging API. – Wolvie123 Oct 17 '21 at 16:29

1 Answers1

0

If you are just trying to see the request and response the Chrome DevTools Network tab will have all that information for you. The DevTools must be open when you make the request.

Bart
  • 19
  • 2
  • I am able to see the information. I wanted to know if it was possible to send this message to the logging API. – Wolvie123 Oct 17 '21 at 23:13