Skip to content

How to do math operations in templates #7922

Answered by princechaddha
clancyb00m asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @clancyb00m, The response time for this discussion was much longer than usual. You can perform math operations as shown in the following example:

id: math-operations

info:
  name: Math operations
  author: princechaddha
  severity: info
variables:
  string: "aaaaa"
  hex: "{{hex_encode(string)}}"
  substract: "{{to_number(hex)-1}}"

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    matchers:
      - type: status
        status:
          - 200

    extractors:
      - type: dsl
        dsl:
          - string
          - hex
          - substract
[math-operations:status-1] [http] [info] https://google.com [aaaaa,6161616161,6161616160]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by princechaddha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants