3

I have this curl:

curl -i --user 'nuni:Iconi1080!' --noproxy '*' -H "Content-Type: application/json" -XPOST "https://intratest.com/services/tomcat/v2/server/deploy" -d '{"user": "nuni" ,"name": "pol", "isName": "nuni8", "envName": "Dv", "tomcatEnvironment": "task", "applicationVersion": "0.0.1"}'

but when i run it thought Intelil I have this error:

java.net.URISyntaxException: Illegal character in scheme name at index 4:
Nuñito Calzada
  • 4,394
  • 47
  • 174
  • 301
  • 1
    Can you specify how you are running your curl command through IntelliJ? The exception given only indicates that some java code attempted to parse a string that did not begin with "https://" as expected. Could it be attempting to parse "curl -i..." by mistake? In IntelliJ the best way to execute a http command is with a .http requst file, which offers a handy curl conversion tool (see https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html#converting-curl-requests) – Richard Woods Sep 03 '21 at 06:54

2 Answers2

1

I think you have some empty spaces before or after https:, you should remove them.

Sharofiddin
  • 340
  • 2
  • 14
0

You haven't provided the java code but from examining the cURL you shared, I can see that you have a missing " after the word 'pol' in the JSON data part. so basically, the JSON seems broken, which could raise a problem later on in your java app.

bentz123
  • 1,081
  • 7
  • 16
  • there is no java code, I run it from the command line or Intellij window – Nuñito Calzada Aug 29 '21 at 22:21
  • Did adding the quote mark after pol worked for you? The cURL command sends the payload to https://test.com/services/tomcat/v2/server/deploy with the credentials. What is the code behind this endpoint. I believe the exception is raised from there – bentz123 Aug 30 '21 at 05:02
  • I added it with the same result – Nuñito Calzada Aug 30 '21 at 07:17
  • test.com/services/tomcat/v2/server/deploy doesn't seem like the actual endpoint you are using. Is there a different endpoint you are pointing to in your development environment? I saw that you edited the JSON data payload in your question, which is good, but if the issue persists, I still think we need to understand what's going on at the endpoint part as the exception seems to be bubbling from there. Please try to provide additional information. – bentz123 Aug 30 '21 at 07:45
  • test.com is in fact an Intranet endPoint – Nuñito Calzada Aug 30 '21 at 08:00
  • 1
    OK, did you write the code for this endpoint? can you share it? I want to see if there is any part of your code that uses new URL(...) or new URI(...) - and check the actual URI/URL which is provided to it. This is probably an issue that indicates that the url/uri string is not encoded properly. See here for example https://stackoverflow.com/questions/749709/how-to-deal-with-the-urisyntaxexception – bentz123 Aug 30 '21 at 08:13