Skip to content

Commit

Permalink
inject-server: correctly wire through method in AdminHttpClient
Browse files Browse the repository at this point in the history
Problem

The HTTP method is not passed into `createApiRequest`,
causing all requests to use the default GET method.
This prevents calling the admin endpoint with the POST method.

Solution

Pass the method parameter in.

Differential Revision: https://phabricator.twitter.biz/D584988
  • Loading branch information
mattdickinson5 authored and jenkins committed Nov 25, 2020
1 parent 3cd8bfc commit 8d84612
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -53,6 +53,12 @@ Changed
producers/consumers. Producer tracing is turned on by default and consumer tracing is turned off
by default now. ``PHAB_ID=D571064``

Fixed
~~~~~~~

* inject-server: Wire through HTTP method in AdminHttpClient so that POST requests can be made to
HTTPAdmin endpoints. ``PHAB_ID=D584988``

20.10.0
-------

Expand Down
Expand Up @@ -79,7 +79,7 @@ private[twitter] abstract class AdminHttpClient private[twitter] (
method: Method
): Response = {

val request = createApiRequest(path)
val request = createApiRequest(path, method)
httpAdminClient(
request,
addAcceptHeader(accept, headers),
Expand Down
Expand Up @@ -435,6 +435,17 @@ class EmbeddedTwitterServerIntegrationTest extends Test {
}
}

test("server#httpPostAdmin sends a valid POST request") {
val embeddedServer = new EmbeddedTwitterServer(
twitterServer = new TwitterServer {},
)
try {
embeddedServer.httpPostAdmin("/quitquitquit", andExpect = Status.Ok, withBody = "quitting\n")
} finally {
embeddedServer.close()
}
}

/* utility method tests */

test("method#reduceScopedFunction") {
Expand Down

0 comments on commit 8d84612

Please sign in to comment.