mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Remove wrapper around response object
Before:
```json
{'data': {'template': '…'}}
```
There’s no need to wrap the response in key because there will only
ever be one valid key for the template preview endpoint.
Flatter is better:
```json
{
'content': '…',
'subject': '…',
'template_type': '…',
…
}
```
The response will be different if there’s an error, but you should be
checking the status code first anyway.
This commit:
- changes the template preview endpoint to return the above format
- adds a test to make sure that the original `/service/…/template/…`
endpoint still returns JSON in the same format (with a `data` key)
This commit is contained in:
@@ -108,7 +108,7 @@ def preview_template_by_id_and_service_id(service_id, template_id):
|
||||
|
||||
data['subject'], data['content'] = template_object.replaced_subject, template_object.replaced
|
||||
|
||||
return jsonify(data=data)
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@template.route('/<uuid:template_id>/version/<int:version>')
|
||||
|
||||
Reference in New Issue
Block a user