public static GivenStatement NewApiKey(this GivenStatement givenStatement, TestUserApiKeyJsonEntity apiKey, string testKey = null) { givenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Saving api keys {apiKey}", givenStatement.GetType().Name); givenStatement.AddData(apiKey, BddKeyConstants.NewApiKey + testKey); return(givenStatement); }
public HttpResponseMessage PostApiKeys(string tokenValue, TestUserApiKeyJsonEntity apiKeys) { using (HttpClient client = HttpClientFactory.Create()) { client.DefaultRequestHeaders .Accept .Add(new MediaTypeWithQualityHeaderValue(CommonHttpConstants.ApplicationJsonMedia)); if (tokenValue != null) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(CommonHttpConstants.AuthorizationHeader, tokenValue); } return(client.LogAndPost($"{BaseApiRoute}/{PostApiKeysRoute}", new StringContent(apiKeys.ToString(), Encoding.UTF8, CommonHttpConstants.ApplicationJsonMedia), Logger)); } }