# SendBytes

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.HTTP/tree/main/Frends.HTTP.SendBytes>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method : `Method`       | <p>The HTTP Method to be used with the request.</p><p>Possible values:</p><ul><li><code>POST</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>PUT</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>PATCH</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>DELETE</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>HEAD</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>OPTIONS</code>:</li></ul><p>The HTTP Method to be used with the request.</p><ul><li><code>CONNECT</code>:</li></ul><p>The HTTP Method to be used with the request.</p><p><br>Default: <code>0</code><br>Example: <code>GET</code></p> |
| Url : `String`          | <p>The URL with protocol and path. You can include query parameters directly in the url.</p><p><br>Default: <code><https://example.org/path/to></code><br>Example: <code><https://example.org/path/to></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ContentBytes : `Byte[]` | <p>The content to send as byte array</p><p><br>Default: <code>-</code><br>Example: <code>{ "Body": "Message" }</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Headers : `Header[]`    | <p>List of HTTP headers to be added to the request.</p><p><br>Default: <code>-</code><br>Example: <code>Name: Header, Value: HeaderValue</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| {% endtab %}            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

{% tab title="Parameter: Options" %}

| Name                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authentication : `Authentication`                     | <p>Method of authenticating request</p><p>Possible values:</p><ul><li><code>None</code>:</li></ul><p>Method of authenticating request</p><ul><li><code>Basic</code>:</li></ul><p>Method of authenticating request</p><ul><li><code>WindowsAuthentication</code>:</li></ul><p>Method of authenticating request</p><ul><li><code>WindowsIntegratedSecurity</code>:</li></ul><p>Method of authenticating request</p><ul><li><code>OAuth</code>:</li></ul><p>Method of authenticating request</p><ul><li><code>ClientCertificate</code>:</li></ul><p>Method of authenticating request</p><p><br>Default: <code>-</code><br>Example: <code>OAuth</code></p> |
| Username : `String`                                   | <p>If WindowsAuthentication is selected you should use domain\username</p><p><br>Default: <code>-</code><br>Example: <code>Username</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 🗝Password : `String`                                 | <p>Password for the user</p><p><br>Default: <code>-</code><br>Example: <code>Password123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 🗝Token : `String`                                    | <p>Bearer token to be used for request. Token will be added as Authorization header.</p><p><br>Default: <code>-</code><br>Example: <code>Token123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ClientCertificateSource : `CertificateSource`         | <p>Specifies where the Client Certificate should be loaded from.</p><p>Possible values:</p><ul><li><code>CertificateStore</code>:</li></ul><p>Specifies where the Client Certificate should be loaded from.</p><ul><li><code>File</code>:</li></ul><p>Specifies where the Client Certificate should be loaded from.</p><ul><li><code>String</code>:</li></ul><p>Specifies where the Client Certificate should be loaded from.</p><p><br>Default: <code>0</code><br>Example: <code>File</code></p>                                                                                                                                                      |
| ClientCertificateFilePath : `String`                  | <p>Applicable only when Certificate Source is "File".</p><p>Path to the Client Certificate, pfx (pkcs12) files are recommended. For other supported formats, see</p><p><https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2collection.import?view=netframework-4.7.1></p><p><br>Default: <code>-</code><br>Example: <code>domain\path</code></p>                                                                                                                                                                                                                                                |
| ClientCertificateInBase64 : `String`                  | <p>Applicable only when Certificate Source is "String".</p><p>Client certificate bytes as a base64 encoded string, pfx (pkcs12) format is recommended. For other supported formats, see</p><p><https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2collection.import?view=netframework-4.7.1></p><p><br>Default: <code>-</code><br>Example: <code>domain\path</code></p>                                                                                                                                                                                                                         |
| 🗝ClientCertificateKeyPhrase : `String`               | <p>Applicable only when Certificate Source is "File" or "String".</p><p>Key phrase (password) to access the certificate data</p><p><br>Default: <code>-</code><br>Example: <code>string value</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| CertificateThumbprint : `String`                      | <p>Applicable only when Certificate Source is "CertificateStore".</p><p>Thumbprint for using client certificate authentication.</p><p><br>Default: <code>-</code><br>Example: <code>thumbprint</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| CertificateStoreLocation : `CertificateStoreLocation` | <p>Applicable only when Certificate Source is "CertificateStore".</p><p>Store location for the certificate.</p><p>Possible values:</p><ul><li><code>CurrentUser</code>:</li></ul><p>Applicable only when Certificate Source is "CertificateStore".</p><p>Store location for the certificate.</p><ul><li><code>LocalMachine</code>:</li></ul><p>Applicable only when Certificate Source is "CertificateStore".</p><p>Store location for the certificate.</p><p><br>Default: <code>0</code><br>Example: <code>CurrentUser</code></p>                                                                                                                     |
| LoadEntireChainForCertificate : `Boolean`             | <p>Should the entire certificate chain be loaded from the certificate store and included in the request. Only valid when using Certificate Store as the Certificate Source</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                      |
| ConnectionTimeoutSeconds : `Int32`                    | <p>Timeout in seconds to be used for the connection and operation.</p><p><br>Default: <code>30</code><br>Example: <code>30</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| FollowRedirects : `Boolean`                           | <p>If FollowRedirects is set to false, all responses with an HTTP status code from 300 to 399 is returned to the application.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| AllowInvalidCertificate : `Boolean`                   | <p>Do not throw an exception on certificate error.</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| AllowInvalidResponseContentTypeCharSet : `Boolean`    | <p>Some Api's return faulty content-type charset header. This setting overrides the returned charset.</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ThrowExceptionOnErrorResponse : `Boolean`             | <p>Throw exception if return code of request is not successfull</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| AutomaticCookieHandling : `Boolean`                   | <p>If set to false, cookies must be handled manually. Defaults to true.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| {% endtab %}                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

{% tab title="Result: Result" %}

| Name                                   | Description                                                                                                      |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Body : `String`                        | <p>Body of response<br>Example: <code>{"id": "abcdefghijkl123456789", "success": true, "errors": \[]}</code></p> |
| Headers : `Dictionary<String, String>` | <p>Headers of response<br>Example: <code>{\[ "content-type": "application/json", ... ]}</code></p>               |
| StatusCode : `Int32`                   | <p>Statuscode of response<br>Example: <code>200</code></p>                                                       |
| {% endtab %}                           |                                                                                                                  |

{% tab title="Changelog" %}

## Changelog

### \[1.5.0] - 2026-03-02

#### Added

* Added CertificateStoreLocation option to allow selection between CurrentUser and LocalMachine certificate stores when using certificate authentication.

### \[1.4.0] - 2025-10-10

#### Changed

* Changed the return type of SendBytes from Task to Task

  ### \[1.3.0] - 2025-03-25

  #### Changed

  * Update packages: Newtonsoft.Json 12.0.1 -> 13.0.3 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 System.Runtime.Caching 7.0.0 -> 9.0.3 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.7.0 -> 17.13.0 MSTest.TestAdapter 2.1.2 -> 3.8.3 MSTest.TestFramework 2.1.2 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0 RichardSzalay.MockHttp 6.0.0 -> 7.0.0 xunit.extensibility.core 2.4.2 -> 2.9.3

  ### \[1.2.0] - 2025-04-10

  #### Changed

  * Updated the default display format for the `ContentBytes` option to `Expression`.

  ### \[1.1.0] - 2024-12-30

  #### Changed

  * Descriptions of ClientCertificate suboptions includes clearer information about usage in terms of different types of ClientCertificate.

  ### \[1.0.0] - 2023-05-30

  #### Added

  * Initial implementation.
    {% endtab %}
    {% endtabs %}
