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

struct Comic: 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
struct Comic: Codable{
struct Comic: Codable {


static func getJSON() async throws {
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)
try await 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

@zamderax zamderax closed this Apr 24, 2025
Sign up for free to 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