[old local changes] add content-type

This commit is contained in:
DarkCat09 2024-08-23 20:50:37 +04:00
parent 5f1d0338c9
commit ab67b00717
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

View file

@ -16,6 +16,7 @@ HTTP_URL = 'http://127.0.0.1:8080'
class TestTCP(TestCase): class TestTCP(TestCase):
def setUp(self) -> None: def setUp(self) -> None:
self.skipTest('Not implemented yet')
self.sock = socket.socket() self.sock = socket.socket()
self.sock.connect(TCP_ADDR) self.sock.connect(TCP_ADDR)
@ -38,6 +39,7 @@ class TestTCP(TestCase):
class TestUDP(TestCase): class TestUDP(TestCase):
def setUp(self) -> None: def setUp(self) -> None:
self.skipTest('Useless until no client API')
self.sock = socket.socket(type=socket.SOCK_DGRAM) self.sock = socket.socket(type=socket.SOCK_DGRAM)
def test_nm(self) -> None: def test_nm(self) -> None:
@ -69,13 +71,20 @@ class TestHTTP(TestCase):
'POST', 'POST',
HTTP_URL + '/post', HTTP_URL + '/post',
body=device.http_req_data(), body=device.http_req_data(),
headers={
'Content-Type': 'application/x-www-form-urlencoded',
},
)) ))
def test_json(self) -> None: def test_json(self) -> None:
self.skipTest('Not implemented yet')
self._check_status(self.http.request( self._check_status(self.http.request(
'POST', 'POST',
HTTP_URL + '/json', HTTP_URL + '/json',
body=device.json_req_data(), body=device.json_req_data(),
headers={
'Content-Type': 'application/json',
},
)) ))
def _check_status(self, resp: urllib3.HTTPResponse) -> None: def _check_status(self, resp: urllib3.HTTPResponse) -> None: