Failed 401 Несанкционированная ошибка, отображаемая в транспортире - PullRequest
0 голосов
/ 31 августа 2018

Я пытаюсь автоматизировать ответ, который генерируется в инструменте почтальона, но получаю ошибку 401, неавторизованная ошибка. пытался разрешить разными способами, передав точный маркер безопасности токену авторизации, но это не сработало.

//In this method the security token passed is newly generated and it works fine and produces response 200 in postman tool
    async claimsetResponseOP(SecurityToken:string){
       var options = {
       method: 'POST',
       url: 'http://nhsappchna8086/LMHIAService/api/v3/ValueSet/$expand',
       //Giving header to the request 
       headers: {
              'Authorization-Token': SecurityToken,  // Here is the place where the security token is passed in the headers
               'Accept': 'application/json+fhir',
               'Content-Type' : 'application/json+fhir',
               'Authorization-Type' : 'Native'
              },
              body: {
                 "resourceType ": "Parameters",
                  "parameter": [
                        {
                          "name": "ValueSet",
                          "resource": {
                                "resourceType": "ValueSet",
                                "status": "active",
                                "compose": {
                                "include": [{
                                        "system": "http://snomed.info/sct",
                                        "filter": [{
                                             "property": "constraint",
                                             "op": "=",
                                             "value": "<<(*:R363698007=271629002)"
                                            }
                                        ]
                                    }
                                ]
                              }
                            }
                          }
                        ]
                      },
                      json:true,
                      resolveWithFullResponse: true
                     }; 
//Error gets displayed in below line as Failed 401 unautorized error
                  await requestp(options).then(async function(response){    
                    await  requestp(options).then(async function(Content){
                            if (await response.statusCode == 200){
                                    var info =  Content.body; 
                              }
                            })
                       })
                    }

Ниже отображается ошибка при выполнении: Может кто-нибудь, пожалуйста, помогите в решении

Failed: 401 - {"resourceType":"OperationOutcome","id":"AUTH-01","text":{"status":"additional","div":"Unauthorised"},"issue":        [{"severity":"error","code":"security","details":{"text":"9254 - Unauthorised"}}]}

1 Ответ

0 голосов
/ 02 сентября 2018

Нет. Вручную, когда я бегу, он работает нормально.

...