gogetta69
CDCloudflare Developers
•Created by gogetta69 on 9/22/2024 in #workers-help
Has Anyone Successfully Used the POST Method with Python
No matter how I try to form the fetch() it sends a GET request to the server.
from js import fetch, Response
async def handle_request(request):
req = await fetch("https://example.com", {
'method': 'POST',
'headers': {
'Content-Type': 'application/json',
},
'body': '{"test": "data"}'
})
response_data = await req.text() return Response.new(response_data) async def on_fetch(request): return await handle_request(request)
response_data = await req.text() return Response.new(response_data) async def on_fetch(request): return await handle_request(request)
1 replies