0

I am working on a .NET API at the moment and I am trying to write NUnit tests, using Refit to connect to my API. When I try to access my API with Refit, I keep receiving an HTTP error code 405, indicating that the method I am trying to access is "not allowed". I have learned from other sources that this might be an issue with POST methods. In that case, how should I correctly use POST methods with Refit? Currently, I am routing all requests through an interface with formatting like this for a POST method, for example.

[Get("/DBAccess/createpost")]
Task<bool> CreatePost(PostModel model);

Thank you.

1 Answers1

0

You have a 'GET' method on your code. Just change GET by POST on your 'CreatePost':

[Post("/DBAccess/createpost")]
Talenel
  • 422
  • 2
  • 6
  • 25