(operation_model, http_response)
| 151 | |
| 152 | |
| 153 | def get_response(operation_model, http_response): |
| 154 | protocol = operation_model.service_model.resolved_protocol |
| 155 | response_dict = { |
| 156 | 'headers': http_response.headers, |
| 157 | 'status_code': http_response.status_code, |
| 158 | } |
| 159 | # TODO: Unfortunately, we have to have error logic here. |
| 160 | # If it looks like an error, in the streaming response case we |
| 161 | # need to actually grab the contents. |
| 162 | if response_dict['status_code'] >= 300: |
| 163 | response_dict['body'] = http_response.content |
| 164 | elif operation_model.has_streaming_output: |
| 165 | response_dict['body'] = StreamingBody( |
| 166 | http_response.raw, response_dict['headers'].get('content-length') |
| 167 | ) |
| 168 | else: |
| 169 | response_dict['body'] = http_response.content |
| 170 | |
| 171 | parser = parsers.create_parser(protocol) |
| 172 | return http_response, parser.parse( |
| 173 | response_dict, operation_model.output_shape |
| 174 | ) |
nothing calls this directly
no test coverage detected