Skip to content

Credentials not sent when using "credentials: include" in a POST request #62864

@jordimarimon

Description

@jordimarimon

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

No

Description

I was trying to use the new option "credentials: include" instead of "withCredentials: true".

The GET requests correctly sets the "credentials: include" option in the fetch implementation but the POST request doesn't.

I saw the following line in the post method that uses "addBody" to create the options:

return this.request<any>('POST', url, addBody(options, body));

The "addBody" function doesn't make use of the "credentials" option:

function addBody<T>(

If I use "withCredentials: true" instead of "credentials: include" everything works fine.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No error

Please provide the environment you discovered this bug in (run ng version)

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 20.1.3
Node: 22.12.0
Package Manager: npm 11.4.2
OS: linux x64

Angular: 20.1.3
... build, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, router, service-worker

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.3
@angular-devkit/core         20.1.3
@angular-devkit/schematics   20.1.3
@schematics/angular          20.1.3
rxjs                         7.8.2
typescript                   5.8.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: common/httpIssues related to HTTP and HTTP Client

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions