Closed RuzsaGergely closed 4 years ago
For my API, I need to format the URL suffix in the requests because I read the parameters from a file (Like the number of the server). If I do format the suffix then for some reason, the request will fail. Example:
char url_sufix[512]; Format(url_sufix, sizeof(url_sufix), "/getTasks/%s", servernum); httpClient.Get(url_sufix, OnJobReceived);
But If I write the exact string to it then it works. Example:
httpClient.Get("/getTasks/9", OnJobReceived);
The "servernum" variable is not empty for sure, because I can print to chat the "url_suffix" content and it works fine.
What can I do about it?
%s is for strings, you need %d for whole numbers. See https://wiki.alliedmods.net/Format_Class_Functions_(SourceMod_Scripting)#Format_Specifiers
%s
%d
Yep, that was the issue. Thanks for the heads up!
For my API, I need to format the URL suffix in the requests because I read the parameters from a file (Like the number of the server). If I do format the suffix then for some reason, the request will fail. Example:
But If I write the exact string to it then it works. Example:
The "servernum" variable is not empty for sure, because I can print to chat the "url_suffix" content and it works fine.
What can I do about it?