KV Value Update handles Data wrongly
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu từ các entry point values.update() và metadata.get() rồi kiểm tra cách value, metadata và Content-Type được gửi đi. Tái tạo request với cả hai trường, sau đó thêm kiểm thử hồi quy cho hành vi metadata như dự kiến. Hoàn tất khi metadata được lưu riêng và values.get() không còn trả về metadata như một phần của value.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Confirm this is a Python library issue and not an underlying Cloudflare API issue.
- This is an issue with the Python library
Describe the bug
When trying to set a value in the KV Store metadata needs to be provided, but gets merged into the value and no meta data gets set.
In [29]: response = client.kv.namespaces.values.update(key_name="test", value="MY VALUE", metadata="{}", **kv.params)
In [30]: print(client.kv.namespaces.values.get(key_name="test", **kv.params).text())
{"metadata":"{}","value":"MY VALUE"}
In [31]: print(client.kv.namespaces.metadata.get(key_name="test", **kv.params) is None)
True
The problem seems to be caused from the whole body of the request being used as the actual value. The behaviour seems to be correct when manually specifying the request's content tye as multipart/form-data:
In [38]: response = client.kv.namespaces.values.update(key_name="test", value="MY VALUE", metadata="{}", **kv.params, extra_headers={"Content-Type": "multipart/form-data"})
In [39]: print(client.kv.namespaces.values.get(key_name="test", **kv.params).text())
MY VALUE
In [40]: print(client.kv.namespaces.metadata.get(key_name="test", **kv.params))
{}
This should probably be the default behaviour as it shouldn't be necessary to explicitly override the content type. On the other hand metadata should not be required in which case the whole body could be set as value
To Reproduce
- Call
values.update()with avalueandmetadata. Both are set as the actual value. metadata.get()doesn't return any metadata.- Metadata is returned with the value upon calling
values.get().
Code snippets
OS
Every OS
Python version
3.12
Library version
v4.0.0
- Ngôn ngữ chính
- Python
- Star
- 512
- Fork
- 155
- Merge trung bình
- 2 giờ 2 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
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
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloudflare/cloudflare-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
cloudflare/cloudflare-python#2747 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
cloudflare/cloudflare-python#2718 · 1 bình luận ·
-
`client.pages.projects.list` returns a paginated list of `Deployment`s instead of `Project`sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cloudflare/cloudflare-python#2692 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
cloudflare/cloudflare-python#2679 · 4 bình luận · 5 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
cloudflare/cloudflare-python#2745 · 2 bình luận ·
Tất cả issue của cloudflare/cloudflare-python
Issue tương tự
-
[request] poppler-data/0.4.12Đang mởupstream update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conan-io/conan-center-index#31098 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
john-kurkowski/tldextract#382 ·
-
comp/tools duplicate P2 sweeper:risk-compatibility tool/mcp type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#132042 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepset-ai/haystack#13092 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
feder-cr/invisible_playwright_mcp#1408 ·
Maintainer thường phản hồi trong vòng 1 ngày