Bugfixes..

- ModelsBuilder: Inject PublishedValueFallback into static Mixins
- ModelsBuilder: Throw exception if compiler can't compile the code
- CheckIfUserTicketDataIsStaleAttribute: Scope issue
- Ambiguous Actions: Couldn't determine the action when empty arrays was passed. Fixed by using more v8 like solution. (Still stupid the client not just have different endpoints)
- Fixed issue with reading the body from post requests. Often we where not allowed to seek in the stream.
- UmbracoHelper: Made available on UmbracoViewPage
- Client entity.resource.js: Don't ask server when getByIds has 0 ids.
- Client content.resource.js: Renamed endpoint GetEmptyBlueprint to avoid ambiguous action name
This commit is contained in:
Bjarke Berg
2021-01-29 10:30:28 +01:00
parent 04058fb9c6
commit 14284b64c2
27 changed files with 454 additions and 303 deletions

View File

@@ -1,4 +1,4 @@
using System.IO;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
@@ -74,24 +74,36 @@ namespace Umbraco.Extensions
public static string GetRawBodyString(this HttpRequest request, Encoding encoding = null)
{
request.Body.Seek(0, SeekOrigin.Begin);
if (request.Body.CanSeek)
{
request.Body.Seek(0, SeekOrigin.Begin);
}
using (var reader = new StreamReader(request.Body, encoding ?? Encoding.UTF8, leaveOpen: true))
{
var result = reader.ReadToEnd();
request.Body.Seek(0, SeekOrigin.Begin);
if (request.Body.CanSeek)
{
request.Body.Seek(0, SeekOrigin.Begin);
}
return result;
}
}
public static async Task<string> GetRawBodyStringAsync(this HttpRequest request, Encoding encoding = null)
{
if (!request.Body.CanSeek)
{
request.EnableBuffering();
}
request.Body.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(request.Body, encoding ?? Encoding.UTF8, leaveOpen: true))
{
var result = await reader.ReadToEndAsync();
request.Body.Seek(0, SeekOrigin.Begin);
return result;
}
}