Wiremock JS ha un problema con la risposta di template

0

Domanda

{
    "request": {
        "method": "POST",
        "urlPathPattern": "/v1/customer"
    },
    "response": {
        "status": 200,
        "headers": {
            "Content-Type": "application/json"
        },
        "bodyFileName": "data/customer-{{jsonPath request.body '$.cid'}}.json",
        "transformers": ["response-template"]
    }
}
  • In Mac, sta funzionando bene!

  • In Linux, sta dando questo errore:

<pre> Server Error</pre></p><h3>Caused by:</h3>
<pre>java.lang.RuntimeException: java.io.FileNotFoundException:
 /mocks/./__files/data/customer-{{jsonPath request.body &apos;$.cid&apos;}}.json
  (No such file or directory)\n

C'è qualche soluzione o una soluzione? Apprezzato!

javascript linux node.js wiremock
2021-11-24 01:08:53
1

Migliore risposta

0

Io consiglio sempre di eseguire Wiremock via Mobile per evitare problemi come "funziona sulla mia macchina".

Tuttavia, ciò che funziona per noi, su tutte le macchine è il seguente:

{
   "city": "{{jsonPath request.body '$.contact[0].contactMedium[0].characteristic.city'}}",
   "postCode": "{{jsonPath request.body '$.contact[0].contactMedium[0].characteristic.postCode'}}",
   "street1": "{{jsonPath request.body '$.contact[0].contactMedium[0].characteristic.street1'}}",
   "type": "{{jsonPath request.body '$.contact[0].contactMedium[0].characteristic.type'}}",
}

Ho geuss il sistema operativo non piace &apos;$.cid&apos;.

Ed è necessario assicurarsi che il file esista così. Per me, ho sempre fornire un file di default per evitare Wiremock la rottura. E quindi utilizzare priority per ignorare una richiesta specifica.

2021-12-02 08:08:26

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................