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

[SDK-3975] Log all HTTP activity #1581

Merged
merged 11 commits into from
Jan 24, 2024

Commits on Jan 16, 2024

  1. Remove Request from IHttp

    It’s just an implementation detail of the web class.
    lawrence-forooghian committed Jan 16, 2024
    Configuration menu
    Copy the full SHA
    272ab42 View commit details
    Browse the repository at this point in the history
  2. Remove agent from IHttp

    It’s just an implementation detail of the Node class.
    lawrence-forooghian committed Jan 16, 2024
    Configuration menu
    Copy the full SHA
    2a840c0 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Rename IHttp to IPlatformHttp

    I’m going to introduce a platform-agnostic class called Http.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    5dce7f7 View commit details
    Browse the repository at this point in the history
  2. Create a platform-agnostic HTTP client

    This will hold HTTP-related functionality that’s shared across
    platforms, such fallback host usage or logging.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    6db96f6 View commit details
    Browse the repository at this point in the history
  3. Use doUri inside web’s HTTP.do

    Makes it consistent with the Node version.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    aef1771 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8eda771 View commit details
    Browse the repository at this point in the history
  5. Tighten the type of HTTP request body a bit

    Looked into what types we pass, because I wanted to understand it better
    for some logging that I’m going to add. Thought I might as well update
    the types to reflect what I’d found out.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    e86ebf9 View commit details
    Browse the repository at this point in the history
  6. Base64 encode binary data when logging response

    To avoid loss of information when unprintable characters (e.g. in
    MessagePack responses) get replaced (either by console.log or by the
    terminal, not sure which) with U+FFFD.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    7cd8580 View commit details
    Browse the repository at this point in the history
  7. Use inspect when printing Resource response body

    Else we often just see "[object Object]" in the logs.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    258af9a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f36f537 View commit details
    Browse the repository at this point in the history
  9. Log all HTTP requests

    Owen requested this during a review of #1526, which strips most of our
    logging from the modular variant of the SDK, but aims to still log all
    network activity.
    
    A bonus benefit is that we now also have logging for requests which get
    tried against different hosts, which we previously didn’t.
    
    The log statements are adaptations of the existing ones in resource.ts.
    lawrence-forooghian committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    d43f965 View commit details
    Browse the repository at this point in the history