question

Shuo C2 avatar image
0 Likes"
Shuo C2 asked Phil BoBo edited

Http.Request with query param laden url doesn't seem to send

I'm trying to send out a Http.Request (GET) with a url attached with query params.

I'm able to hit the server with the following (confirm by logs and a 502 response)

  1. Http.Request request = Http.Request("example-api.com");
  2. request.method = Http.Method.Get;
  3. Http.Response response = request.sendAndWait();

However, when trying with the following

  1. Http.Request request = Http.Request("example-api.com?param1=123");
  2. request.method = Http.Method.Get;
  3. Http.Response response = request.sendAndWait();
  4. print(response.value);
  5. print(response.statusCode);

The output console displays

  1. (empty line here, code formatter deletes it if I leave it as empty line)
  2. 0

With logs on the server end showing the call didn't go through

Any ideas here?

FlexSim 21.0.0
flexsim 21.0.0https
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
1 Like"
Phil BoBo answered Phil BoBo edited

The Http.Request() constructor that takes a URL doesn't parse out parameters. It only takes the protocol, host, port, and reference path. See FlexScript Class - Http.Request (flexsim.com)

Put the parameters into the data property. FlexScript Class - Http.Request (flexsim.com)

I'll add a case to the dev list to consider parsing the parameter data out of the URL in that constructor.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.