首页 > 解决方案 > Angular HTTP POST 响应在暂存中给出 404 Not Found Error 但在本地工作

问题描述

我正在开发与 REST 服务交互的 Angular UI 门户。我向现有的 REST 服务添加了更多端点。Swagger 和 Postman 对新的端点服务进行了 200 响应测试。此外,当我从本地的角度 UI 中点击服务时,我得到 200 响应。但是在 PCF 中的暂存服务器上部署时收到“404 Not Found”。同一服务中的其他端点返回成功。来自 Chrome 开发工具的错误响应...

error: {timestamp: "2020-08-13T19:36:44.354+0000", status: 404, error: "Not Found", message: "No message available", path: "/updtPOShipStatus"}
headers: e {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message: "Http failure response for https://ipaddress: 404 Not Found"
name: "HttpErrorResponse"
ok: false
status: 404
statusText: "Not Found"
url: "https://ipaddress/updtPOShipStatus"
httpOptions = {
    headers: new HttpHeaders({
      'Content-Type': 'application/json',
      'Access-Control-Allow-Headers': 'Content-Type'
    })
  };

  public updatePOflagStatus(poShipStatus: PurchaseOrderFlagStatus) : Observable<any>{
    const poShipStatusRequestBody = {
      poShipStatus : poShipStatus
    };
    return this.httpClient.post(this.updateShipStatusUrl, poShipStatusRequestBody, this.httpOptions);
  }

我也无法在本地复制问题。请帮忙。

标签: angulartypescript

解决方案


推荐阅读