diff --git a/mockintosh/transpilers.py b/mockintosh/transpilers.py index 04744ce5..6c5341db 100644 --- a/mockintosh/transpilers.py +++ b/mockintosh/transpilers.py @@ -47,7 +47,7 @@ def path_oas_to_handlebars(self, path: str) -> Tuple[str, Union[int, None]]: if match is not None: name = match.group(1).strip() new_segments.append('{{ %s }}' % name) - last_param_index = i + 1 + last_param_index = i else: new_segments.append(segment) return '/'.join(new_segments), last_param_index @@ -226,11 +226,9 @@ def _transpile_responses( 'headers': {} } - if content_type is not None: - response['headers']['Content-Type'] = content_type - - if 'schema' in _response: - ref = self._transpile_schema(_response['schema']) + if 'content' in _response: + response['headers']['Content-Type'] = 'application/json' # FIXME: this is a dirty hack for a single case + ref = self._transpile_schema(_response['content']['application/json']['schema']) response['body'] = self._transpile_body_json_object(ref, last_path_param_index=last_path_param_index) if 'headers' in _response: @@ -330,4 +328,4 @@ def transpile(self, direct: bool = False) -> Union[str, dict]: file.close() - return target_path + return target_path \ No newline at end of file