Closed tahir-jamil closed 5 years ago
Hi @tahir-jamil,
I tested this post
method with our SDK sample app, however, was unable to recreate the issue. For your convenience, I am attaching a GIF file. You can see that the request type is handled correctly from the server.
Can you check if the backend handles the request correctly?
ya i have also studied on it and found that its not working in case of localhost but for server url its working
i am using lumen api in laravel and use the server of laravel so my db is not in the xampp or mamp local server and thats why i am unable to access my server using my notebook id
i am not good in db and backend services also so for now i am unable to run laravel lumen on xampp or mamp i am working on it so that it might work
but for server url its works perfectly fine as post
do you have test with localhost with php backend?
@tsonevn well i have tested it and found thats its the issue of my database not the http its the laravel issue so i think its done for angular side
i have almost find the issue but it is unclear yet , wait i will describe you about it when i request the data from http as a post request its in json formate and the header are www urlencoded so lumen does not received the params
if i force http to send data as www urlencoded like
let body = new URLSearchParams();
body.set('duroodCount', "tahir");
body.set('party_id', "23");
force to send data in key value pair then the data is successfully post in the db but the strange this is that my data is saved in the database and the network in that case is the same Get request also in network their are no params its strange but my data is posted in the mysql db
Hi @tahir-jamil,
Did you find, what is causing the issue with the HTTP request and whether it is a problem with NativeScript?
Also, keep in mind that in NativeScript Angular we are using @angular/common/http
module provided by Angular. Regarding that, the issue might be related to a problem in the Angular's module.
well did not get any cause for that right know
Hi @tahir-jamil, I think we can close this issue for now. I will reopen it when we have stable steps to reproduce, which can be used for debugging and show that the problem is related to NativeScript
ok no problem
When i send post request to php backend it will read as a get instead of post. and params are not pass to the backend i am using httpclient module as
import { NativeScriptHttpClientModule } from "nativescript-angular/http-client";
hear is the post function ` private serverUrl = "http://localhost:8000/api"; postCountsData(data: any) { let options = this.createRequestOptions(); return this.http.post(this.serverUrl+'/counts', {duroodCount: 11}, {headers: options}); }` these are my header
hear i subscribe
Hear is the preview as you can see we have get method instead of post
i have also try to use JSON.stringify but nothing happened some friends says i have to use server url but i don't have any server yet then how can we solve this issue
My package.json is