Skip to content

Can't use netlify.request #113

Open
Open
@quedicesebas

Description

@quedicesebas

Describe the bug
I need to use the request info in my app, you say I can inject in my components constructor the netlify.request, and, for example, print on the console the request url, but where can I see that output running locally with netlify serve? Please help

To Reproduce
Steps to reproduce the behavior:

  1. I added the @Inject('netlify.request') @Optional() request?: Request, to the main component (AppComponent), the home page component and a service constructors:
constructor(
    // ...
    @Inject('netlify.request') @Optional() request?: Request,
    @Inject('netlify.context') @Optional() context?: Context,
  ) {
    console.log(`#request:`, request);
  }
  1. I run first with netlify serve, but no console output was shown. Then, I used netlify dev, and got path: undefined
    headers: undefined everywhere.

Expected behavior
Be able to obtain the request url and headers to extract info and use to SSR load data.

Versions

  • Angular.js: 18.0.0

If you're using the CLI to build

  • OS: Windows
  • netlify/cli version: 17.23.8

If you're using file-based installation

  • netlify.toml:

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions