Skip to content

Commit 718f82c

Browse files
authored
Merge pull request #474 from mtgto/set_content_type_to_response
Add Content-Type to HttpBody and Text HttpResponse
2 parents 67d7c16 + 5551347 commit 718f82c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ All notable changes to this project will be documented in this file. Changes not
1818
1919
# [Unreleased]
2020

21+
## Added
22+
23+
- Set `Content-Type` to HttpBody and Text HttpResponse. ([#474](https://github.com/httpswift/swifter/pull/474)) by [@mtgto](https://github.com/mtgto)
24+
2125
## Fixed
2226

2327
* Fix misspell `serialise`. ([#473](https://github.com/httpswift/swifter/pull/473)) by [@mtgto](https://github.com/mtgto)

Xcode/Sources/HttpResponse.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public enum HttpResponse {
136136
case .ok(let body):
137137
switch body {
138138
case .json: headers["Content-Type"] = "application/json"
139-
case .html: headers["Content-Type"] = "text/html"
139+
case .html, .htmlBody: headers["Content-Type"] = "text/html"
140+
case .text: headers["Content-Type"] = "text/plain"
140141
case .data(_, let contentType): headers["Content-Type"] = contentType
141142
default:break
142143
}

0 commit comments

Comments
 (0)