1/*
2 * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16#include <aws/core/http/standard/StandardHttpResponse.h>
17
18#include <aws/core/utils/StringUtils.h>
19#include <aws/core/utils/memory/AWSMemory.h>
20
21#include <istream>
22
23using namespace Aws::Http;
24using namespace Aws::Http::Standard;
25using namespace Aws::Utils;
26
27
28HeaderValueCollection StandardHttpResponse::GetHeaders() const
29{
30 HeaderValueCollection headerValueCollection;
31
32 for (Aws::Map<Aws::String, Aws::String>::const_iterator iter = headerMap.begin(); iter != headerMap.end(); ++iter)
33 {
34 headerValueCollection.emplace(HeaderValuePair(iter->first, iter->second));
35 }
36
37 return headerValueCollection;
38}
39
40bool StandardHttpResponse::HasHeader(const char* headerName) const
41{
42 return headerMap.find(StringUtils::ToLower(headerName)) != headerMap.end();
43}
44
45const Aws::String& StandardHttpResponse::GetHeader(const Aws::String& headerName) const
46{
47 Aws::Map<Aws::String, Aws::String>::const_iterator foundValue = headerMap.find(StringUtils::ToLower(headerName.c_str()));
48 return foundValue->second;
49}
50
51void StandardHttpResponse::AddHeader(const Aws::String& headerName, const Aws::String& headerValue)
52{
53 headerMap[StringUtils::ToLower(headerName.c_str())] = headerValue;
54}
55
56
57