micropython / micropython/micropython-lib

requests: HTTP/1.1 response bodies and max_body limit

Open
#1,118 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

Summary

Extend the requests package with essential HTTP/1.1 client behaviour:

  • Send requests as HTTP/1.1 (default), keep Connection: close
  • Read response bodies with Content-Length and chunked Transfer-Encoding
  • Case-insensitive response headers
  • Fix relative Location in redirects (closes #931)
  • Default max response size 32 KiB (max_body kwarg to override/disable)

Out of scope (follow-up PRs)

  • TLS certificate verification (#838)
  • Real stream=True / incremental body read (#777)
  • gzip Content-Encoding, keep-alive pool, cookies

Testing

Unix port + ESP32 with fork mip index; extend test_requests.py socket mocks.

PR will follow from branch requests-http11-essentials.

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 with the requests package and the socket mocks in test_requests.py, then run the existing request tests on the Unix port. Done means the tests cover HTTP/1.1 requests, response body length and chunked transfer, case-insensitive headers, relative redirects, and the max_body limit on Unix and ESP32.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.