Skip to content

ng build/serve --prod breaks @angular/common/http #10605

Closed
@buu700

Description

@buu700

Versions

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


Angular CLI: 6.0.0-rc.10
Node: 9.11.1
OS: darwin x64
Angular: 6.0.0-rc.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.13
@angular-devkit/build-angular     0.5.13
@angular-devkit/build-optimizer   0.5.13
@angular-devkit/core              0.5.13
@angular-devkit/schematics        0.5.13
@angular/cli                      6.0.0-rc.10
@ngtools/webpack                  6.0.0-rc.11
@schematics/angular               0.5.13
@schematics/update                0.5.13
rxjs                              6.0.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • git clone https://github.com/buu700/ng6-http-test.git
  • cd ng6-http-test
  • npm install .
  • ng serve --prod

This project is a small modification of ng new's output which runs the following:

this.httpClient.request(
	new HttpRequest('GET', 'https://na.cdn.cyph.com/cyph.ws/current')
).subscribe(event => {
	console.log({event});
});

Observed behavior

Logged to console:

{event: {type: undefined}}
{event: {
	body: 1524888620241,
	headers: e {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ},
	ok: true,
	status: 200,
	statusText: "OK",
	type: undefined,
	url: "https://na.cdn.cyph.com/cyph.ws/current"
}}

Desired behavior

As when building/serving without --prod, HttpEvent.type should be defined.

Mention any other details that might be useful (optional)

Also reproduced with CLI version 6.0.0-rc.7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions