mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-03 05:34:07 +02:00
Fix not setting custom scheme response status text correctly
This commit is contained in:
parent
9ede2e1ccc
commit
89b8977f7d
@ -1,6 +1,6 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetLib.Browser.Interfaces;
|
using TweetLib.Browser.Interfaces;
|
||||||
using TweetLib.Browser.Request;
|
using TweetLib.Browser.Request;
|
||||||
@ -14,8 +14,9 @@ internal sealed class CefSchemeResourceVisitor : ISchemeResourceVisitor<IResourc
|
|||||||
private CefSchemeResourceVisitor() {}
|
private CefSchemeResourceVisitor() {}
|
||||||
|
|
||||||
public IResourceHandler Status(SchemeResource.Status status) {
|
public IResourceHandler Status(SchemeResource.Status status) {
|
||||||
var handler = CreateHandler(Encoding.UTF8.GetBytes(status.Message));
|
var handler = CreateHandler(Array.Empty<byte>());
|
||||||
handler.StatusCode = (int) status.Code;
|
handler.StatusCode = (int) status.Code;
|
||||||
|
handler.StatusText = status.Message;
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,9 +32,7 @@ public IResourceHandler File(SchemeResource.File file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceHandler CreateHandler(byte[] bytes) {
|
private static ResourceHandler CreateHandler(byte[] bytes) {
|
||||||
var handler = ResourceHandler.FromStream(new MemoryStream(bytes), autoDisposeStream: true);
|
return ResourceHandler.FromStream(new MemoryStream(bytes), autoDisposeStream: true);
|
||||||
handler.Headers.Set("Access-Control-Allow-Origin", "*");
|
|
||||||
return handler;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user