angular-odata-es5 icon indicating copy to clipboard operation
angular-odata-es5 copied to clipboard

Params in DefaultRequestOptions missing in request.

Open bkardol opened this issue 6 years ago • 1 comments

In my application I am using this library to request some resources through odata endpoints. I configured the library by injecting my own config:

@Injectable()
class ODataConfig extends ODataConfiguration {
  baseUrl = "https://localhost:44364/";
  defaultRequestOptions = Object.assign(this.defaultRequestOptions, 
    { 
      params: new HttpParams().set('api-version', "1.0"), 
      headers: new HttpHeaders().set("test", "test") 
    });
}

This config is working as it picks up the baseUrl and the headers. Unfortunately, if I request data through the ODataService<T> it is missing the HttpParams I added to the defaultRequestOptions. I am sending a request with the following line (where odata is of type ODataService<T>) : this.odata.Query().Exec()

Am I missing something here? Thanks!

bkardol avatar Feb 07 '19 07:02 bkardol

Hi In my case, I'm consuming SAP Odata Services and I need to send x-csrf token with a post request How can I handle it?

Shivam-Fullstack avatar Sep 14 '20 06:09 Shivam-Fullstack