Skip to content

Commit

Permalink
Fixed Rocket + Github Integration (#76)
Browse files Browse the repository at this point in the history
* Disable Linting and Documentation in macOS
* fixing issue with let/var
* fixing linting issues
  • Loading branch information
leogdion committed Dec 2, 2020
1 parent 6635e43 commit afbf6ea
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*'
- 'feature/*'
- 'release/*'
tags: '*'

jobs:
build:
Expand All @@ -32,6 +33,7 @@ jobs:
- name: Build
run: swift build
- name: Lint
if: startsWith(github.ref, 'refs/tags/') != true
run: swift run swiftformat --lint . && swift run swiftlint
- name: Run tests
run: swift test -v --enable-code-coverage
Expand All @@ -42,7 +44,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Build Documentation
if: ${{ matrix.xcode == '/Applications/Xcode_12.3.app' }}
if: ${{ matrix.xcode == '/Applications/Xcode_12.3.app' && !startsWith(github.ref, 'refs/tags/') }}
run: |
swift run sourcedocs generate build -cra
git config --local user.email "action@github.com"
Expand Down
19 changes: 19 additions & 0 deletions Documentation/Reference/MistKitNIO/structs/MKAsyncRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@
public struct MKAsyncRequest: MKHttpRequest
```

## Properties
### `client`

```swift
public let client: HTTPClient
```

### `url`

```swift
public let url: URL
```

### `data`

```swift
public let data: Data?
```

## Methods
### `execute(_:)`

Expand Down
6 changes: 6 additions & 0 deletions Documentation/Reference/MistKitNIO/structs/MKAsyncResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ public struct MKAsyncResponse: MKHttpResponse
```

## Properties
### `response`

```swift
public let response: HTTPClient.Response
```

### `body`

```swift
Expand Down
8 changes: 4 additions & 4 deletions Sources/MistKitNIO/MKAsyncRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ public struct MKAsyncRequest: MKHttpRequest {
public let data: Data?

public func execute(_ callback: @escaping ((Result<MKHttpResponse, Error>) -> Void)) {
let request: HTTPClient.Request
var request: HTTPClient.Request

do {
request = try HTTPClient.Request(url: url, method: data == nil ? .GET : .POST)
} catch {
callback(.failure(error))
return
}

if let data = data {
request.body = .data(data)
request.headers.add(name: "Content-Type", value: "application/json")
}

client.execute(request: request).map(MKAsyncResponse.init).whenComplete(callback)
}
}
2 changes: 1 addition & 1 deletion Sources/MistKitNIO/MKAsyncResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MistKit

public struct MKAsyncResponse: MKHttpResponse {
public let response: HTTPClient.Response

public var body: Data? {
return response.body.map { Data(buffer: $0) }
}
Expand Down

0 comments on commit afbf6ea

Please sign in to comment.