3

When using the Refit REST Library to build a client targeting an asp.net based api is it possible to mix Query and Body items in a single Custom Object?

Example Asp.Net Route

[Route("documents/{id}")]
public void PostDocument(int id, [FromBody] document)

Example Refit Client and Request Object showing desired mixing of Body and Query definition in single object

[Post("/documents/{document.id}")]
Task PostDocument(PostDocumentRequest request);
public class PostDocumentRequest 
{
    public int Id { get;set; }
    public [Query] DateTime? LocalDateTime { get;set; }
    public [Body] Document Document { get;set; }
}
GrantByrne
  • 849
  • 10
  • 21
Grant Trevor
  • 1,052
  • 9
  • 23

0 Answers0