Scripting
There are two ways you can write custom scripting in Thunder Client for advanced use cases.
- Inline Scripting: You can write javascript code inside the Thunder Client views.
- Custom Filters: You can write code in separate javascript files and attach it to a collection.
Inline Scripting
- JavaScript code can be written directly within Thunder Client views.
- You have the flexibility to write scripts in the following contexts:
- Request Level
- Folder Level
- Collection Level
- Additionally, scripts can be authored in
Pre-Request
andPost-Request
scripts.
Pre Request Script
- Run Pre Request script from
Pre Run
->Scripting
tab, useful to set Env Variables
Post Request Script
- Run the Post Request script from
Tests
->Scripting
tab. - Useful to do clean-up tasks, set environment variables from the response and assertions.
Logs
- You can log messages to the Output Window using
console.log
in the script. - For more details, please refer to the Logs section.
Convert Postman Script
- We provide a guide to convert Postman scripts to Thunder Client scripts.
- For more details, please refer to the Convert Postman Script section.