From 464f87fdb533d8b4a36d553321d68fb205593359 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Fri, 17 Feb 2023 12:27:08 +0100 Subject: [PATCH] Change error for missing cap --- Sources/App/CapServer+Routes.swift | 2 +- Sources/App/Error.swift | 6 +++--- Sources/App/Router+Extensions.swift | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Sources/App/CapServer+Routes.swift b/Sources/App/CapServer+Routes.swift index c035ea8..6b34940 100755 --- a/Sources/App/CapServer+Routes.swift +++ b/Sources/App/CapServer+Routes.swift @@ -35,7 +35,7 @@ extension CapServer { } // Upload an image - app.postCatching("images", .parameter("cap")) { request in + app.postCatching("image", .parameter("cap")) { request in try self.ensureOperability() try authenticator.authorize(request) guard let cap = request.parameters.get("cap", as: Int.self) else { diff --git a/Sources/App/Error.swift b/Sources/App/Error.swift index f3de109..dd688b5 100644 --- a/Sources/App/Error.swift +++ b/Sources/App/Error.swift @@ -12,7 +12,7 @@ enum CapError: Error { /** - HTTP Code: 404 + HTTP Code: 410 */ case unknownId @@ -55,8 +55,8 @@ enum CapError: Error { var response: HTTPResponseStatus { switch self { - /// 404 - case .unknownId: return .notFound + /// 410 + case .unknownId: return .gone /// 400 case .invalidBody: return .badRequest /// 406 diff --git a/Sources/App/Router+Extensions.swift b/Sources/App/Router+Extensions.swift index 153794e..93b8354 100644 --- a/Sources/App/Router+Extensions.swift +++ b/Sources/App/Router+Extensions.swift @@ -1,10 +1,3 @@ -// -// Router+Extensions.swift -// App -// -// Created by Christoph on 05.05.20. -// - import Vapor extension Application {