In my application, I'm using angular 8 client to get data from my spring boot server, here is the get requesr from the server:
@RequestMapping(value = "/Flowers", method = RequestMethod.GET)
public HttpEntity<FlowersList> getFlowersFromFlowers(@RequestHeader String realityId,
@RequestParam("mName") String mName)
And my relecent client code:
httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
params: new HttpParams().set('realityId', '0')
};
constructor(private http: HttpClient) { }
getFileList(): Observable<any> {
return this.http.get(`${this.baseUrl}`,this.httpOptions);
}
I keep on getting the following error from the server:
[org.springframework.web.bind.MissingRequestHeaderException: Missing request header 'realityId' for
method parameter of type String]
I was trying to follow this stuck overflow question and this tutorial but didn't get any luck. I want to pass in my request header the value '0'(string) for the server's 'realityId' field. Any help would be appreciated, been stuck on this one for quite awhile
edit: been trying to do it like this:
httpOptions = {
headers: new HttpHeaders({ 'realityId': '0' })
};
still nothing..