fatmanverse opened a new issue, #12916: URL: https://github.com/apache/seatunnel/issues/12916
### Search before asking - [x] I had searched in the issues and found no similar issues. ### What happened `POST /submit-job` fails with `IllegalStateException: STREAMED` when the request does not declare a non-form content type. `curl -d` / `curl --data-binary` send `Content-Type: application/x-www-form-urlencoded` by default, so a plain curl call with a HOCON, SQL or JSON body fails: ``` $ curl -X POST 'http://127.0.0.1:8080/submit-job?format=hocon' --data-binary @job.conf {"status":"fail","message":"IllegalStateException: STREAMED"} ``` ``` java.lang.IllegalStateException: STREAMED at org.apache.seatunnel.shade.org.eclipse.jetty.server.Request.getReader(Request.java:1188) at org.apache.seatunnel.engine.server.rest.servlet.BaseServlet.requestBody(BaseServlet.java:144) at org.apache.seatunnel.engine.server.rest.servlet.SubmitJobServlet.doPost(SubmitJobServlet.java:46) ``` `SubmitJobServlet#doPost` reads the options (`format`, `jobName`, `jobId`, ...) with `HttpServletRequest#getParameterMap()` before it reads the body. For a form-encoded request Jetty parses the body as form fields there and consumes the input stream, so the following `getReader()` throws. The same body is accepted with `-H 'Content-Type: text/plain'` or `application/json`. Measured on `dev` e2957d2: | body | Content-Type | result | | --- | --- | --- | | HOCON, `?format=hocon` | (curl default) | `IllegalStateException: STREAMED` | | SQL, `?format=sql` | (curl default) | `IllegalStateException: STREAMED` | | JSON | (curl default) / `application/x-www-form-urlencoded` | `IllegalStateException: STREAMED` | | HOCON / SQL | `text/plain` | submitted | | JSON | `application/json` | submitted | The other body-reading endpoints (`/submit-jobs`, `/stop-job`, `/encrypt-config`, ...) do not call `getParameterMap()` and are not affected. ### Expected behavior `/submit-job` reads the job config from the body and its options from the query string, regardless of the content type. ### SeaTunnel Version dev (3.0.1-SNAPSHOT, e2957d2) ### Zeta or Flink or Spark Version Zeta ### Java or Scala Version JDK 11 ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
