Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

target_http

Marcel Kloubert edited this page Nov 1, 2017 · 26 revisions

Home >> Targets >> http

HTTP

Deploys to a HTTP server/service.

The content of the file will be submitted via the request body.

{
    "deploy": {
        "targets": [
            {
                "type": "http",
                "name": "My HTTP service",
                "description": "A HTTP service on a HTTP server, e.g.",

                "url": "https://host.example.com/webdav/?file=${VSDeploy-File}",
                "method": "PUT",
                "headers": {
                    "X-My-Custom-Header-Date": "Submission date: ${VSDeploy-Date}",
                    "X-My-Custom-Header-File": "The file path is: ${VSDeploy-File}",
                    "X-My-Custom-Header-FileMime": "The mime type of the file: ${VSDeploy-File-Mime}",
                    "X-My-Custom-Header-FileName": "The file name is: ${VSDeploy-File-Name}",
                    "X-My-Custom-Header-FileChanged": "The time the file has been changed: ${VSDeploy-File-Time-Changed}",
                    "X-My-Custom-Header-FileCreated": "The time the file has been created: ${VSDeploy-File-Time-Created}",
                    "X-My-Custom-Header-FileSize": "The file size is: ${VSDeploy-File-Size}"
                },
                "submitContentLength": true,
                "submitFileHeader": true,
                "user": "mkloubert", "password": "P@ssword123!"
            }
        ]
    }
}

Instead of submitting the file contents in the request body, a GET request can supply file metadata to a locally running server.

{
    "deploy": {
        "targets": [
            {
                "type": "http",
                "name": "My Local Webserver",
                "description": "A HTTP service that is running locally, e.g.",

                "url": "http://localhost/webdav/?file=file:${workspaceRoot}${VSDeploy-File}&path=/${VSDeploy-File-Root}",
                "method": "GET",
                "encodeUrlValues": false,
                "submitFile": false,
                "user": "mkloubert", "password": "P@ssword123!"
            }
        ]
    }
}
Name Description
encodeUrlValues Encode URL values with encodeURIComponent or not. Default: (true)
headers The optional list of additional request headers to send.
method The HTTP method to use. Default PUT
password The optional password for Basic authentication.
promptForPassword Prompt for a password if not defined. Default: (true)
submitContentType Submit the Content-type request header or not. Default: (true)
submitContentLength Submit the Content-length request header or not. Default: (true)
submitDate Submit the Date request header or not. Default: (true)
submitFile Submit the content of a file or not. Default: (true)
submitFileHeader Submit the X-vsdeploy-file request header that contains the path of the file that is submitted. Default: (false)
transformer* The path to the script that transforms data before it is send.
transformerOptions Optional data for the transformer script.
url The request URL.
user The optional username for Basic authentication.

* supports placeholders

Placeholders

As you can see in the setting example, headers and url can use placeholders from your settings.

The following values are also available:

Name Description Example
VSDeploy-Date The submission (not the file) date in RFC 2822 format. Sun, 23 Sep 1979 05:09:00 GMT
VSDeploy-File The path of the file that is submitted. /the/path/of/the/file.txt
VSDeploy-File-Mime The mime/content type of the file that is submitted. text/plain
VSDeploy-File-Name The name of the file that is submitted. file.txt
VSDeploy-File-Size The size of the file that is submitted. 5979
VSDeploy-File-Time-Changed The time the file that is submitted has been changed. Fri, 23 Sep 2016 05:09:00 GMT
VSDeploy-File-Time-Created The time the file that is submitted has been created. Mon, 05 Sep 2016 23:09:00 GMT
Clone this wiki locally