Questions tagged http

Explore the latest questions and answers asked by our top developers.

Using HttpClient to make get requests

I have written the following code to get the dummy data here: export class AppComponent { jsonPosts: any = []; constructor(private httpClient: HttpClient) { } OnInit() { this.getJsonPosts(); } getJsonPosts(): any { return this.httpClient.get("") .subscribe(response => { console.log(response); this.jsonPosts = response; }); } I have also written the following code to display them in my […]

By CatarinaRuna
Categorized as angular, html, http, json, typescript Tagged , , , ,

HttpOnly cookie generated on the server is present in Set-Cookie header but is not being saved while running locally

I have an Angular application with Spring boot in the backend. On the server side I generate an HttpOnly cookie, which is then to be saved. @CrossOrigin(origins = "*", allowedHeaders = "*", allowCredentials = "true") @GetMapping("token") public AuthenticationResponseDto generateToken( HttpServletResponse response) {"Creating token"); String username = "user"; String password = "pass"; authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password)); […]

By techyyy
Categorized as angular, cookies, http, spring-boot, web Tagged , , , ,

What is the proper and cleaner way to hide parameters with sensitive data in URL with .Net (backend) + Angular app?

For example I have an endpoint which shows me details about certain user where 2 is a user ID. http://localhost:4200/user/2 My question is how to hide this last parameter from URL address with proper way. My goal is to have only something like http://localhost:4200/user I am using .Net for Backend and Angular for client app. […]

By Matteoni
Categorized as .net, angular, c#, http, webapi Tagged , , , ,

Getting ERR_CERT_INVALID when accessing self signed angular app through ip address, but works on localhost

I have a simple app and I added a ssl folder with a key and a certificate. When running ‘ng serve –host –ssl’ and open the app locally, this is the result: my browser accepts my certificate and shows my app as https. but when trying to access my app from another computer or […]

How can I access the Incoming Message object using HttpClient in Angular?

I am sending the following request to the server from my Angular file. Can this be accessed from my typescript file (preferably using a HttpClient object) ? IncomingMessage { … headers: { host: ‘localhost:8080’, connection: ‘keep-alive’, accept: ‘application/json, text/plain, */*’, ‘content-type’: ‘application/json’, ‘sec-fetch-site’: ‘same-origin’, ‘sec-fetch-mode’: ‘cors’, ‘accept-encoding’: ‘gzip, deflate, br’, ‘accept-language’: ‘en-US,en;q=0.9’, cookie: ‘_iAToken=<cookie>’ }, […]

By Wolvie123
Categorized as angular, http, javascript, typescript Tagged , , ,

data not loading in html component after http request

I have the following code on the http service: fetchInformation(): Observable<any>{ const body = { id: }; return this.http .post<any>(url, body); } on my component.ts file: ngOnInit(){ this.fetchInformation(); } fetchInformation(){ this.httpService.fetchInformation().subscribe( response => { this.content = response; } ); } And on my html file I want to show the content <input class="form-control" type="text" […]

By gustavo martins
Categorized as angularjs, http, typescript Tagged , ,

mapping http response to object array in type argument

I wonder if someone can explain this error to me, since Im relatively new to angular, typescript and rxjs. What I try to do is to map the server response I get for calling getHeroes() in a format that makes it easy for my components to consume it. This is my getHeroes() method that is […]

By Vultimitavin
Categorized as angular, http, observable, rxjs, typescript Tagged , , , ,

Angular http post request fails, but axios one works

I’m doing a POST request with Angular 9 HttpClient but it fails with ‘Provisional headers are shown’ My code is like: const header = { headers: new HttpHeaders({ ‘Access-Control-Allow-Origin’: ‘*’, ‘Content-Type’: ‘application/x-www-form-urlencoded’, }) }; const req = new HttpRequest(‘POST’, url, bytes, { headers: header.headers, reportProgress: true, }); return this.http.request(req).pipe( map((event) => { if (multyStepsUpload) { […]

By Kaloyan Stamatov
Categorized as angular, axios, http, httpclient, javascript Tagged , , , ,

Angular service: How can I wait for an http call to finish, access its data and return it after i got the response?

I have an http service with contains User object that I use to store certain data about my user for my route guard (e.g. isAdmin). It also contains a login method, which I plan to use to log in and to get the user object from the response (in case it returns 200). My problem […]

By Kleecarim
Categorized as angular, http, rxjs, typescript Tagged , , ,

Retrieving a certain property from an http response

I am currently writing an angular service that gets data from my server. The res contains certain properties like the username for example that I need to save in the service so my guards/components can access it from outside without calling the server every time they need it Here is the code for my service […]

By Kleecarim
Categorized as angular, http, typescript Tagged , ,
1 41

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us