Repository: sanic-org/sanic

Issue:
JSONResponse defaults to None content-type
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

```python
@app.get("/")
async def handler(request: Request):
    return JSONResponse({"message": "Hello World!"})
```
```sh
╰─▶ curl localhost:9999   
HTTP/1.1 200 OK
content-length: 26
connection: keep-alive
alt-svc: 
content-type: None

{"message":"Hello World!"}
```

### Code snippet

_No response_

### Expected Behavior

`content-type: application/json`

### How do you run Sanic?

Sanic CLI

### Operating System

all

### Sanic Version

LTS+

### Additional context

_No response_

Discussion:
codecov[bot]: ## [Codecov](https://codecov.io/gh/sanic-org/sanic/pull/2737?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org) Report
Patch and project coverage have no change.
> Comparison is base [(`6eaab2a`)](https://codecov.io/gh/sanic-org/sanic/commit/6eaab2a7e5be418385856371fdaebe4701f8c4fc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org) 88.938% compared to head [(`93e86b8`)](https://codecov.io/gh/sanic-org/sanic/pull/2737?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org) 88.938%.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##              main     #2737   +/-   ##
=========================================
  Coverage   88.938%   88.938%           
=========================================
  Files           92        92           
  Lines         6952      6952           
  Branches      1185      1185           
=========================================
  Hits          6183      6183           
  Misses         527       527           
  Partials       242       242           
```


| [Impacted Files](https://codecov.io/gh/sanic-org/sanic/pull/2737?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org) | Coverage Δ | |
|---|---|---|
| [sanic/response/types.py](https://codecov.io/gh/sanic-org/sanic/pull/2737?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org#diff-c2FuaWMvcmVzcG9uc2UvdHlwZXMucHk=) | `84.831% <ø> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org)

</details>

[:umbrella: View full report in Codecov by Sentry](https://codecov.io/gh/sanic-org/sanic/pull/2737?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sanic-org).


Patch:
diff --git a/sanic/response/types.py b/sanic/response/types.py
index 3f93855d..d3c8cdb6 100644
--- a/sanic/response/types.py
+++ b/sanic/response/types.py
@@ -345,7 +345,7 @@ class JSONResponse(HTTPResponse):
         body: Optional[Any] = None,
         status: int = 200,
         headers: Optional[Union[Header, Dict[str, str]]] = None,
-        content_type: Optional[str] = None,
+        content_type: str = "application/json",
         dumps: Optional[Callable[..., str]] = None,
         **kwargs: Any,
     ):


Test patch:
diff --git a/tests/test_response_json.py b/tests/test_response_json.py
index c89dba42..aa1c61dd 100644
--- a/tests/test_response_json.py
+++ b/tests/test_response_json.py
@@ -213,3 +213,12 @@ def test_pop_list(json_app: Sanic):
 
     _, resp = json_app.test_client.get("/json-pop")
     assert resp.body == json_dumps(["b"]).encode()
+
+
+def test_json_response_class_sets_proper_content_type(json_app: Sanic):
+    @json_app.get("/json-class")
+    async def handler(request: Request):
+        return JSONResponse(JSON_BODY)
+
+    _, resp = json_app.test_client.get("/json-class")
+    assert resp.headers["content-type"] == "application/json"