File tree

9 files changed

+17
-32
lines changed

9 files changed

+17
-32
lines changed
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@ fastlane/report.xml
6363
fastlane/screenshots
6464

6565
Packages/
66-
*.xcodeproj
66+
*.xcodeproj
67+
buildlinux
68+
Package.resolved
69+
PADockerfile_build
70+
.build_lin
File mode changed.
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
//
2-
// Package.swift
3-
// Perfect JSON API Example
4-
//
5-
// Created by Jonathan Guthrie on 2016-09-26.
6-
// Copyright (C) 2015 PerfectlySoft, Inc.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
//
10-
// This source file is part of the Perfect.org open source project
11-
//
12-
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
13-
// Licensed under Apache License v2.0
14-
//
15-
// See http://perfect.org/licensing.html for license information
16-
//
17-
//===----------------------------------------------------------------------===//
18-
//
19-
1+
// Generated automatically by Perfect Assistant Application
2+
// Date: 2017-10-10 14:04:34 +0000
203
import PackageDescription
21-
22-
// Note that the following Swift Package Manager dependancy inclusion will also import other required modules.
234
let package = Package(
24-
name: "Perfect-JSON-API",
25-
targets: [],
26-
dependencies: [
27-
.Package(url: "https://.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2, minor: 0)
5+
name: "Perfect-JSON-API",
6+
targets: [],
7+
dependencies: [
8+
.Package(url: "https://.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 3),
289
]
2910
)
File mode changed.
File mode changed.
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class People {
3131
// Accepts the HTTPRequest object and adds a new Person from post params.
3232
public func add(_ request: HTTPRequest) -> String {
3333
let new = Person(
34-
firstName: request.param(name: "firstName")!,
35-
lastName: request.param(name: "lastName")!,
36-
email: request.param(name: "email")!
34+
firstName: request.param(name: "firstName") ?? "",
35+
lastName: request.param(name: "lastName") ?? "",
36+
email: request.param(name: "email") ?? ""
3737
)
3838
data.append(new)
3939
return toString()
@@ -44,9 +44,9 @@ public class People {
4444
do {
4545
let incoming = try json.jsonDecode() as! [String: String]
4646
let new = Person(
47-
firstName: incoming["firstName"]!,
48-
lastName: incoming["lastName"]!,
49-
email: incoming["email"]!
47+
firstName: incoming["firstName"] ?? "",
48+
lastName: incoming["lastName"] ?? "",
49+
email: incoming["email"] ?? ""
5050
)
5151
data.append(new)
5252
} catch {
File mode changed.
File mode changed.
File mode changed.

0 commit comments

Comments
 (0)