Open jackrankin opened 5 months ago
This is basically the default code except I swapped in my own locally hosted Piston API. I get this error message: 2024/06/14 22:14:32 Unexpected Error. {"message":"requests must be of type application/json"}
import ( "fmt" "log" "net/http" piston "github.com/milindmadhukar/go-piston" ) func runCode() { h := http.DefaultClient client := piston.New("", h, "http://127.0.0.1:2000/api/v2/") execution, err := client.Execute("python", "", []piston.Code{ {Content: "inp = input()\nprint(inp[::-1])"}, }, piston.Stdin("hello world"), ) if err != nil { log.Fatal(err) } fmt.Println(execution.GetOutput()) } func main() { runCode() } ```c
Could be a missing header when making the request. Made a quick fix, can you test and let me know?
This is basically the default code except I swapped in my own locally hosted Piston API. I get this error message: 2024/06/14 22:14:32 Unexpected Error. {"message":"requests must be of type application/json"}