Search code examples
httpshttp-headersinno-setuppascalscriptdwinshs

DwinsHs for Inno Setup: How to add an apikey HTTP header of a request?


I'm using a third party tool by the name of DwinsHs for Inno Setup.

This third party tool provides me the capability for downloading files as part of the installation.

I want to send an HTTPS request to remote server and I would like to pass an apikey to the header of the request but it returns error 401.

This is the code:

[ISPP]
#define fileURL "https://myserver.xom?apikey=XXXX-XXXX-XXXX-XXXX"

[Code]
Source: "<path_to_my_file>"; \
  DestDir: "{app}"; \
  Flags: external deleteafterinstall; \
  Check: DwinsHs_Check( ExpandConstant('<path_to_my_file>'), '{#fileURL}', 'mySetup', 'Get', 0, 0)

Solution

  • I found the solution;

    So, keep the url without ?apkikey=...

    [ISPP]
    #define fileURL "https://myserver.xom"
    

    And adding the apikey in the header by editing const HTTP_HEADER in dwinshs.iss:

      HTTP_HEADER = 'apikey: xxxx-xxxx-xxxx-xxxx';