Skip to content

Commit e31bd98

Browse files
committed
add HTTP response helpers
1 parent 3579076 commit e31bd98

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

Sources/HTTP/HTTP.ServerResponse.swift

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,62 @@ extension HTTP
1515
}
1616
extension HTTP.ServerResponse
1717
{
18-
@inlinable public static
19-
func ok(_ resource:HTTP.Resource) -> Self
18+
@inlinable public
19+
static func ok(_ resource:HTTP.Resource) -> Self
2020
{
2121
.resource(resource, status: 200)
2222
}
2323

24-
@inlinable public static
25-
var noContent:Self
24+
@inlinable public
25+
static func created(_ resource:HTTP.Resource) -> Self
26+
{
27+
.resource(resource, status: 201)
28+
}
29+
30+
@inlinable public
31+
static var noContent:Self
2632
{
2733
.resource("", status: 204)
2834
}
2935

30-
@inlinable public static
31-
func multiple(_ resource:HTTP.Resource) -> Self
36+
@inlinable public
37+
static func multiple(_ resource:HTTP.Resource) -> Self
3238
{
3339
.resource(resource, status: 300)
3440
}
3541

36-
@inlinable public static
37-
func unauthorized(_ resource:HTTP.Resource) -> Self
42+
@inlinable public
43+
static func unauthorized(_ resource:HTTP.Resource) -> Self
3844
{
3945
.resource(resource, status: 401)
4046
}
4147

42-
@inlinable public static
43-
func forbidden(_ resource:HTTP.Resource) -> Self
48+
@inlinable public
49+
static func forbidden(_ resource:HTTP.Resource) -> Self
4450
{
4551
.resource(resource, status: 403)
4652
}
4753

48-
@inlinable public static
49-
func notFound(_ resource:HTTP.Resource) -> Self
54+
@inlinable public
55+
static func notFound(_ resource:HTTP.Resource) -> Self
5056
{
5157
.resource(resource, status: 404)
5258
}
5359

54-
@inlinable public static
55-
func gone(_ resource:HTTP.Resource) -> Self
60+
@inlinable public
61+
static func gone(_ resource:HTTP.Resource) -> Self
5662
{
5763
.resource(resource, status: 410)
5864
}
5965

60-
@inlinable public static
61-
func unsupportedMediaType(_ resource:HTTP.Resource) -> Self
66+
@inlinable public
67+
static func unsupportedMediaType(_ resource:HTTP.Resource) -> Self
6268
{
6369
.resource(resource, status: 415)
6470
}
6571

66-
@inlinable public static
67-
func error(_ resource:HTTP.Resource) -> Self
72+
@inlinable public
73+
static func error(_ resource:HTTP.Resource) -> Self
6874
{
6975
.resource(resource, status: 500)
7076
}

0 commit comments

Comments
 (0)