KV Value Update handles Data wrongly
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia dagli entry point values.update() e metadata.get() e verifica come vengono inviati value, metadata e Content-Type. Riproduci la richiesta con entrambi i campi, quindi aggiungi una copertura di regressione per il comportamento previsto di metadata. Il lavoro è completato quando metadata viene memorizzato separatamente e values.get() non lo restituisce più come parte di value.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 509
- Fork
- 150
- Merge medio
- 3h 15m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudflare/cloudflare-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
cloudflare/cloudflare-python#2747 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
cloudflare/cloudflare-python#2718 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
cloudflare/cloudflare-python#2692 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cloudflare/cloudflare-python#2679 · 4 commenti · 5 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cloudflare/cloudflare-python#2745 · 1 commento ·
Tutte le issue di cloudflare/cloudflare-python
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
use-agent-os/agent-os#3314 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
BasedHardware/omi#15662 · 1 commento ·
-
documentation help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
AiursoftWeb/AnduinOS-2#19 ·