HttpClient in Uno

Is there such a thing in Uno or implement using NSURL etc using Foreign code? I need to be able to post binary data (images)

Look at Uno.Net.Http.

Something like this should work:

using Uno.Net.Http;

HttpMessageHandler client;

public App()
{
    client = new HttpMessageHandler();
    var request = client.CreateRequest("GET", url);
    request.SetHeader("Content-Type", "image/png");
    request.Done += OnDone;
    request.Error += OnError;
    request.SetResponseType(HttpResponseType.String);

    byte[] someBinaryData = new byte[0]; // Put your data here
    request.SendAsync(someBinaryData);
}

void OnDone(HttpMessageHandlerRequest response)
{
    debug_log "Length: " + response.GetResponseContentString();
}

void OnError(HttpMessageHandlerRequest response, string error)
{
    debug_log "Error: " + error;
}

Looks great. thanks.

var request = client.CreateRequest("POST", url);

will work too correct?

Yes, that will work.

Hey guys,

does the http client in uno also handle session cookies?
I want to navigate through a website which sets session cookies. I tried the fetch call as well as xmlhttprequest, which works fine on the first site after login, but if I want to redirect to another site, it automatically logs me out, because both dont safe the cookie which is requested on the next site.
The xhr.withCredentials = true doesnt help aswell.

How can I solve that?

@Benny2871 No, cookies are only relevant for a browser. If you have further questions related to this, please open a new forum thread.