-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send tweet #1
Send tweet #1
Conversation
tweetText = messageRequest.content | ||
} | ||
|
||
var request = HTTPClientRequest(url: "https://api.twitter.com/2/tweets") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define the url as a const
} | ||
} | ||
|
||
private func createHeader() -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest "createAuthHeader", be as specific as possible
request.body = .bytes(ByteBuffer(data: (try JSONSerialization.data(withJSONObject: jsonText)))) | ||
let response = try await httpClient.execute(request, timeout: .seconds(30)) | ||
try await httpClient.shutdown() | ||
if response.headers["location"] == [] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key this off response.status.code
} | ||
} | ||
|
||
private func createHeader() -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write a unit test for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set this function to take function inputs rather than reading directly from the environment, that will make unit testing possible
No description provided.