Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 2d199c4

Browse files
committed
Aggiunta documentazione CustomResponse. closes #29
1 parent 0626ce6 commit 2d199c4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Custom response result configuration
2+
3+
4+
## Example of custom message for a 200 Ok status
5+
6+
```csharp
7+
//with result
8+
return Ok(new DefaultResponse(true, result));
9+
10+
//without result
11+
return Ok(new DefaultResponse(HttpStatusCode.Ok, true));
12+
```
13+
14+
<b>Note:</b> result can be a message in string format or a response class that returns a DTO
15+
16+
## Example of custom message for a 404 NotFound status
17+
18+
```csharp
19+
//with TypeCode, indicated in second position by the value zero
20+
throw new ExceptionResponse(HttpStatusCode.NotFound, 0, "NotFound", "Insert a custom object not found message here");
21+
22+
//without TypeCode
23+
throw new ExceptionResponse(HttpStatusCode.NotFound, "NotFound", "Insert a custom object not found message here");
24+
```
25+
26+
:alarm_clock: More status codes will be added soon

0 commit comments

Comments
 (0)