Pylons / Pylons/webtest

Set 'Accept: application/json' for the TestApp.*_json requests?

Open
#151 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
346
Forks
113
PR merge metrics
No merged PRs in 30d

Description

I'm working on a Pyramid app, which exposes a json rest api.

In the functional tests, I'm using WebTest and its TestApp.*_json() methods to send json requests.

The app looks at (among other things) the Accept header, to know what to send back to the client.

The various TestApp.*_json() methods already set the Content-Type header to application/json, to tell the server that what is sent is json.

It seems to me that they should also set the Accept header to tell the server that the answer they expect should be json.

Does that make sense?

I'd be happy to send a pull request if you agree to this change.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TestApp.*_json() entry points and their existing Content-Type handling, then inspect the related functional tests. Done means the JSON request methods also send an Accept: application/json header and the tests verify that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.