Просмотр исходного кода

Merge branch 'stable' into wildcard-end-route

Michael Enger 5 лет назад
Родитель
Сommit
6739e9e842
2 измененных файлов с 4 добавлено и 2 удалено
  1. 2 1
      CHANGELOG.md
  2. 2 1
      Xcode/Sources/HttpResponse.swift

+ 2 - 1
CHANGELOG.md

@@ -19,7 +19,8 @@ All notable changes to this project will be documented in this file. Changes not
 # [Unreleased]
 
 ## Added
-* Add support for using `**` as a catch-all at the end of a route. ([#479](https://github.com/httpswift/swifter/pull/479)) by [@michaelenger](https://github.com/michaelenger)
+- Add support for using `**` as a catch-all at the end of a route. ([#479](https://github.com/httpswift/swifter/pull/479)) by [@michaelenger](https://github.com/michaelenger)
+- Set `Content-Type` to HttpBody and Text HttpResponse. ([#474](https://github.com/httpswift/swifter/pull/474)) by [@mtgto](https://github.com/mtgto)
 
 ## Fixed
 

+ 2 - 1
Xcode/Sources/HttpResponse.swift

@@ -136,7 +136,8 @@ public enum HttpResponse {
         case .ok(let body):
             switch body {
             case .json: headers["Content-Type"] = "application/json"
-            case .html: headers["Content-Type"] = "text/html"
+            case .html, .htmlBody: headers["Content-Type"] = "text/html"
+            case .text: headers["Content-Type"] = "text/plain"
             case .data(_, let contentType): headers["Content-Type"] = contentType
             default:break
             }