Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not being able to get acces to response when response status is 400 and running in console with maven #286

Closed
adnansarajlic opened this issue Jan 17, 2018 · 6 comments
Labels

Comments

@adnansarajlic
Copy link

adnansarajlic commented Jan 17, 2018

Hi Peter,

I came across a strange issue today. While making a request to an endpoint and expecting status to be 400 with an error everything whent ok in IntelliJ but when I tried to run it with "mvn test" I could not get response to print or match. You can se the line from log:

16:31:10.308 [main] INFO com.intuit.karate - [print] (..stream..)

It's printing (..stream..)

Feature: Test

Background:
* configure headers = read('classpath:headers.js')
* url restUrl

Scenario: Test
Given path 'test'
And request { 'testId': 'TestId1' }
When method post
Then status 400
* print response

@ptrthomas ptrthomas self-assigned this Jan 17, 2018
@ptrthomas ptrthomas added the bug label Jan 17, 2018
@ptrthomas
Copy link
Member

can you try 0.7.0.RC4 and see if this is fixed.

if not, please follow the instructions here: https://github.com/intuit/karate#fileencoding

Really appreciate if you can let me know how it goes.

@ptrthomas ptrthomas added question and removed bug labels Jan 18, 2018
@ptrthomas ptrthomas removed their assignment Jan 18, 2018
@ptrthomas
Copy link
Member

closing since the surefire fix will certainly fix this, the main doc has this FAQ / troubleshooting explained as well.

@adnansarajlic
Copy link
Author

😃 Thanks Peter, it was encoding issue. I tought I found a "real" bug 😉

@ptrthomas
Copy link
Member

@adnansarajlic thanks for confirming :) we know that encoding fixes this. what's not clear to us yet it at what point it starts becoming a stream. can you provide this additional info, it will help:

  • what OS ? Windows ?
  • if you can figure out what is the "default" system file encoding in effect, that would help
  • what is the approximate size of the payload ?

For my reference and for those who come across this issue in future, here is some additional reading: https://issues.apache.org/jira/browse/SUREFIRE-951

@adnansarajlic
Copy link
Author

Yes. I'm running Win10 (Swedish). System file encoding in IntelliJ was windows-1252 but I changed it to UTF-8 an dit did not have any effect. The payload was minimal like the one in example in first post, I was checking error codes. The response is a json with error code, id and message. Response had swedish chars in the message. I did not think about encoding because we are using swedish chars in other responses but maybe first time in combination with response status 400, just guessing. :)
Hope this helps.

Have a nice day!

@ptrthomas
Copy link
Member

@adnansarajlic this helps, thanks ! I think I'll modify the archetype to include the surefire config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants