Skip to content
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

fix: use POST method for token request #11

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

dmitrytrager
Copy link
Contributor

Screenshot 2025-01-16 at 17 01 43

It happened that token info get request uses POST method. This PR fixes method mismatch

@dmitrytrager dmitrytrager force-pushed the fix/post-request-for-token branch from 88bfc21 to 675d3ae Compare January 16, 2025 16:05
@dmitrytrager dmitrytrager marked this pull request as ready for review January 16, 2025 16:09
@dmitrytrager dmitrytrager force-pushed the fix/post-request-for-token branch 3 times, most recently from 7eb9902 to c07f413 Compare January 16, 2025 16:17
@dmitrytrager dmitrytrager requested a review from AlphaB January 16, 2025 16:22
lib/panda.rb Outdated
connection = Faraday.new do |conn|
conn.use Panda::ErrorMiddleware
conn.request :json
conn.response :json
end

response = connection.get(request.url, request.params, request.headers)
response = do_request(connection, request)
Copy link
Member

Choose a reason for hiding this comment

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

We can use connection.run_request(request.method, request.url, request.body, request.headers), it's more flexible in case we will need to add more HTTP methods

@dmitrytrager dmitrytrager force-pushed the fix/post-request-for-token branch from c07f413 to e79c5ea Compare January 16, 2025 22:04
lib/panda.rb Outdated
Panda::HTTPResponse.new(response.status, response.headers, response.body)
end

def do_request(connection, request)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this method?

@dmitrytrager dmitrytrager force-pushed the fix/post-request-for-token branch from e79c5ea to 50cb98d Compare January 17, 2025 12:13
@dmitrytrager dmitrytrager merged commit c12559d into main Jan 17, 2025
5 checks passed
@dmitrytrager dmitrytrager deleted the fix/post-request-for-token branch January 17, 2025 22:09
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