Example #1
0
        // private helpers

        private static void AssertThatRequestInterceptorWritesAuthorizationHeader(AbstractOAuth2ApiBinding apiBinding, string expectedAuthorizationHeaderValue)
        {
            MockRestServiceServer mockServer = MockRestServiceServer.CreateServer(apiBinding.RestTemplate);

            mockServer.ExpectNewRequest()
            .AndExpectUri("https://api.someprovider.com/status/update")
            .AndExpectMethod(HttpMethod.POST)
            .AndExpectHeader("Content-Type", MediaType.APPLICATION_FORM_URLENCODED.ToString())
            .AndExpectHeader("Authorization", expectedAuthorizationHeaderValue)
            .AndExpectBody("status=Hello+there%21");
        }
        // private helpers

        private static void AssertThatRequestInterceptorWritesAuthorizationHeader(AbstractOAuth2ApiBinding apiBinding, string expectedAuthorizationHeaderValue)
        {
            MockRestServiceServer mockServer = MockRestServiceServer.CreateServer(apiBinding.RestTemplate);
            mockServer.ExpectNewRequest()
                .AndExpectUri("https://api.someprovider.com/status/update")
                .AndExpectMethod(HttpMethod.POST)
                .AndExpectHeader("Content-Type", MediaType.APPLICATION_FORM_URLENCODED.ToString())
                .AndExpectHeader("Authorization", expectedAuthorizationHeaderValue)
                .AndExpectBody("status=Hello+there%21");
        }