Skip to content

API Test Case issue (Response Content-Type) with Solution #14

@SnowLLL

Description

@SnowLLL

def test_follow_api_endpoint(self): client = self.get_client() response = client.post(f'/api/profiles/{self.userb.username}/follow', {'action': 'follow'}) count = response.json().get('count') self.assertEqual(count, 1)

Response Content-Type is returned as text/html instead of application/json

Solution:

response = client.post(f'/api/profiles/{self.userb.username}/follow',
{'action': 'follow'}, format='json')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions