Skip to content

Conversation

@zamderax
Copy link

  1. Adding POST and GET examples
  2. Adding easy examples for Codable, GET and POST to the Readme

import NIOCore
import NIOFoundationCompat

structComic:Codable{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
structComic:Codable{
structComic:Codable{


staticfuncgetJSON() asyncthrows{
let httpClient =HTTPClient(eventLoopGroupProvider: .singleton)
let car: Car =Car(make: "Toyota", model: "Camry", year: 2023)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is unused, and so this code snippet won't compile.

request.headers.add(name: "Accept", value: "application/json")
request.method= .POST
request.body= .bytes(jsonData)
tryawait httpClient.shutdown()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example doesn't send the request at all.

@zamderax
Copy link
Author

Closing in favor of #829. I made the PR accidentally off the wrong branch

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@zamderax@Lukasa