Angular uses the same method to request two different interfaces with different request headers

dude, I used the same request method to request two interfaces, but found that the request headers was different and one of the requests failed

this is the request method I encapsulated

  get(url, params: Object = {}): Observable<HttpResponse> {
    let httpParams = new HttpParams();
    Object.keys(params).map(key => {
      httpParams = httpParams.set(key, params[key]);
    });
    if (this.localStorage.getItem("wechat_access_token")) {
      const httpHeaders = new HttpHeaders({
        "Access-Token": this.localStorage.getItem("wechat_access_token"),
        "Access-Control-Allow-Origin": "*",
      });
      return this.http.get<HttpResponse>(environment.host + url, {
        params: httpParams,
        headers: httpHeaders
      });
    } else {
      return this.http.get<HttpResponse>(environment.host + url, {
        params: httpParams,
      });
    }
  }

the first interface initiates the request and request header

  getProduct(productId: any, shopId: string): Observable<HttpResponse> {
    return this.get("shop/index/product", {
      id: productId,
      shop_id: shopId
    });
  }


clipboard.png

request header


clipboard.png

it is found that the request header of the two requests is different, and the access-token of one of the requests is not added to cause the request to fail. Excuse me, bosses, what is the reason for this?

Mar.15,2021

found the problem is related to cross-domain one of the interfaces OPTIONS request backend 500 reasons

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea67f3-46b21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea67f3-46b21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?