View Single Post
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 03-06-2020 , 14:28   Re: REST in Pawn 1.1 - HTTP client for JSON REST APIs (Updated 2019/12/28)
Reply With Quote #65

So you base64-encoded "username:password" and appended the result after "Basic ", as explained on the page I linked?

Edit: seems to work.

PHP Code:
public void OnPluginStart()
{
    
HTTPClient client = new HTTPClient("https://jigsaw.w3.org/HTTP");
    
client.SetHeader("Authorization""Basic Z3Vlc3Q6Z3Vlc3Q=");
    
client.Get("Basic"OnHTTPResponse);
}

public 
void OnHTTPResponse(HTTPResponse responseany value)
{
    
PrintToServer("[Basic] %d"response.Status);

This returns a 200 response. If you comment out client.SetHeader() it returns a 401 response.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 03-06-2020 at 14:45.
DJ Tsunami is offline