karate icon indicating copy to clipboard operation
karate copied to clipboard

responseStatus not visible from functions created using callSingle or callOnce

Open ericdriggs opened this issue 1 year ago • 4 comments

expected: js functions created from callOnce or callSingle should be able to see responseStatus

actual: responseStatus is not defined from those functions callOnce in feature background even breaks local js function ability to view responseStatus

workaround:

  • Use karate.call instead of karate.callSingle

versions effected: 1.3.0 -> 1.4.0

e.g.

replace config = karate.callSingle('classpath:my.feature', config); with config = karate.call('classpath:my.feature', config);

minimal example: https://github.com/ericdriggs/karate-responseStatus-missing-callSingle-callOnce/tree/main

ericdriggs avatar May 30 '23 20:05 ericdriggs

yet to investigate. as a workaround for these JS cases I think you are aware that JS has issues with these edge cases, especially callSingle and anyone is welcome to dive in and contribute a PR

  • try karate.get('responseStatus')
  • also explore if the new karate.response JS API helps: https://github.com/karatelabs/karate/issues/1962

ptrthomas avatar May 31 '23 03:05 ptrthomas

Hi Sir, I think I found a solution a little different to the issue #1962 do, can you assign this to me so that I get a PR?

Songshen1996 avatar Oct 22 '23 09:10 Songshen1996

@Songshen1996 consider this assigned to you. feel free to submit a PR

ptrthomas avatar Oct 22 '23 10:10 ptrthomas

thanks @Songshen1996 for the fix !

ptrthomas avatar Oct 28 '23 11:10 ptrthomas

1.5.0 released

ptrthomas avatar Aug 05 '24 15:08 ptrthomas