feat(json_client): headers param on JsonClient.get — If-None-Match → 304 conditional reads

Đang mở
#165 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Start by reading campus_python/json_client/interface.py and trace JsonClient.get through its concrete implementations and test doubles named in the issue, including CampusRequest. The proposal also mentions Files.get_content, BySlugCollection.get_content, and Files.File.get_content; check their tests before deciding the scope. Done means conditional requests can send If-None-Match and handle 304 as described, with the affected implementations and tests updated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Deferred from #125 / PR #164: campus.api /files content responses (by-slug and by-id) emit an ETag ({size}-{updated_at}) and honor If-None-Match with 304 Not Modified, but the SDK cannot send conditional requests — JsonClient.get(path, query=None) has no headers parameter.

Proposal

  • Add headers: Mapping[str, str] | None = None to JsonClient.get (and, if wanted, the other verbs) in campus_python/json_client/interface.py.
  • Files.get_content / BySlugCollection.get_content / Files.File.get_content could then accept an etag param: send If-None-Match, and on 304 return None (caller keeps its cached copy) instead of raising.

Why not now

A signature change on the client ABC ripples into every concrete implementation and test double fleet-wide (CampusRequest, the campus-suite TestCampusRequest, nyxchange/classroom/admin doubles). Content responses already carry max-age=60, so plain HTTP-layer caching works today; conditional revalidation is a nice-to-have that deserves its own coordinated change.

Refs: #125, #164, campus#1007 (server ETag semantics).

Ngôn ngữ chính
Python
Star
0
Fork
0
Merge trung bình
50 phút
Pull request đã merge (30 ngày)
48

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nyjc-computing/campus-api-python

Tất cả issue của nyjc-computing/campus-api-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.