https://linen.dev logo
#help
Title
# help
t

test

08/11/2023, 2:01 PM
Hello everyone. I want to make mapping for my wiremock server. However I have no idea how to map char array instead of string.
Copy code
"request": {
    "urlPathPattern": "/some/url",
    "method": "GET",
    "headers" : {
      "apiKey": {
        "equalTo": "test"
      }
    }

  }
This mapping will stub for string 'test' but i wanna match it to char. The result would be apiKey [matches] : test | apiKey: [t, e, s, t] <<<<< Header does not match
Copy code
Putting in the mapping  "equalTo": "test"
, ends up with initializationError -> equalTo operand must be a non-null string I tried different options like 'matches' but nothing works. I get char array in header and I cannot change it. How can I stub it?
l

Lee Turner

08/11/2023, 2:31 PM
Sorry, I am not sure I understand your requirement here. Is it that you want to match a request with a header of
apiKey: [t,e,s,t]
t

test

08/11/2023, 2:36 PM
Yup, exactly. I'll have a key with value "test".toCharArray(), so it should match ["t","e","s","t"] the only idea I have come up with would be to use matcher like "value": { "matches": "^(.*[\"t\",\"e\",\"s\",\"t\"]])" } but it looks like a workaround. Or would it be proper solution?
j

Jamie Tanna [he/him]

08/11/2023, 2:38 PM
Out of interest, what problem are you trying to solve here?
3 Views