Skip to content

Commit 2e0226a

Browse files
jakubozgacsantero
authored andcommitted
Added static method MethodNotAllowed in JsonApiException (#127)
1 parent f4f2862 commit 2e0226a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

JSONAPI/Documents/Builders/JsonApiException.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,20 @@ public static JsonApiException CreateForForbidden(string detail = null)
9999
};
100100
return new JsonApiException(error);
101101
}
102+
103+
/// <summary>
104+
/// Creates a JsonApiException to send a 405 Method Not Allowed error.
105+
/// </summary>
106+
public static JsonApiException CreateForMethodNotAllowed(string detail = null)
107+
{
108+
var error = new Error
109+
{
110+
Id = Guid.NewGuid().ToString(),
111+
Status = HttpStatusCode.MethodNotAllowed,
112+
Title = "Method not allowed",
113+
Detail = detail
114+
};
115+
return new JsonApiException(error);
116+
}
102117
}
103118
}

0 commit comments

Comments
 (0)