Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TfrmUtama.sendData(AEndPoint, AJSONData: String): String;
- var
- tok: String;
- stm: TStringStream;
- res: IHTTPResponse;
- sss: String;
- begin
- tok := getToken;
- stm := TStringStream.Create(AJSONData);
- if tok = 'error' then
- begin
- result := tok;
- exit;
- end;
- http.CustomHeaders['Authorization'] := 'Bearer ' + tok;
- http.CustomHeaders['Content-Type'] := 'application/json';
- try
- res := http.Post(BURL_ + AEndPoint, stm);
- except
- on E:Exception do
- begin
- stm.Free;
- result := 'error';
- exit;
- end;
- end;
- stm.Free;
- sss := res.ContentAsString;
- result := sss;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement