HTTP Response Handler - Support for mutiple http response handler scripts for a http request
Greetings!
Currently I am using the response handler scripts to test my http response object. I am including the script using the following syntax:
> my-script.js
But I have several requests that all have some common assertions. The idea was to extract the common assertions in a common file. Something like this:
In my-script.js:
import {commonAssertions} from 'common'; // where 'common' is the JS file containing all the common assertions
I have tried various methods to include this common javacsript file in my response handler scripts. But it is not supported.
I have 2 queries here:
1) Is there a feature request for support of ES6 for http handlers?
2) Is there any other way to achieve the above (having more than 1 javascript http handlers for a http request), till https://youtrack.jetbrains.com/issue/WI-44851?project=WI is implemented?
请先登录再写评论。
You can use
load('/an/absolute/path/to/an/import.js')to include an import into the current script.Unfortunately, there seems to be no way to refer to the import with a relative path. We've tried to get the handler script path and use it, but this code
returns
/PhpStormInstallationDirectory/bin/handler-script.js, which seems to be a design flaw.If using the absolute path would make you happy enough then fine, if it would not - please submit a request on our tracker for this design flaw to be fixed: https://youtrack.jetbrains.com/newIssue?project=WI
Thank you for the reply. I have submitted the following the request :
https://youtrack.jetbrains.com/issue/CPP-16718 to address this issue.