mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-09 13:28:39 +00:00
Publishing gives valid response
This commit is contained in:
parent
65e17cdfc8
commit
15f974fba1
1 changed files with 16 additions and 5 deletions
|
@ -3,24 +3,35 @@ using System.IO;
|
|||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProjectLighthouse.Serialization;
|
||||
using ProjectLighthouse.Types;
|
||||
|
||||
namespace ProjectLighthouse.Controllers {
|
||||
[ApiController]
|
||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||
[Produces("text/plain")]
|
||||
[Produces("text/xml")]
|
||||
public class PublishController : ControllerBase {
|
||||
[HttpPost("startPublish")]
|
||||
public async Task<IActionResult> StartPublish() {
|
||||
Slot slot = await this.GetSlotFromBody();
|
||||
|
||||
return this.Ok(LbpSerializer.TaggedStringElement("slot", "", "type", "user"));
|
||||
}
|
||||
|
||||
[HttpPost("publish")]
|
||||
public async Task<IActionResult> Publish() {
|
||||
string bodyString = await new StreamReader(Request.Body).ReadToEndAsync();
|
||||
return this.Ok(LbpSerializer.TaggedStringElement("slot", bodyString, "type", "user"));
|
||||
}
|
||||
|
||||
public async Task<Slot> GetSlotFromBody() {
|
||||
Request.Body.Position = 0;
|
||||
string bodyString = await new StreamReader(Request.Body).ReadToEndAsync();
|
||||
|
||||
|
||||
XmlSerializer serializer = new(typeof(Slot));
|
||||
Slot slot = (Slot)serializer.Deserialize(new StringReader(bodyString));
|
||||
|
||||
Console.WriteLine(slot);
|
||||
|
||||
return this.Ok();
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue