Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  https.rs

  Sprache: Rust
 

//! HTTPS request/response structures.
use duplicate::duplicate_item;
use serde::{Deserialize, Serialize};
use serde_bytes::ByteBuf;
use tsify::Tsify;

use crate::{
    https::{self, HttpsError},
    remote_secret::{monitor::RemoteSecretMonitorResponse, setup::RemoteSecretSetupResponse},
};

/// Binding version of [`https::HttpsRequest`].
#[derive(Tsify, Serialize)]
#[serde(rename_all = "camelCase")]
#[tsify(into_wasm_abi)]
pub struct HttpsRequest {
    /// Maximum amount of time in milliseconds the request is allowed to take before it should be aborted.
    pub timeout_ms: u32,

    /// HTTPS request URL.
    pub url: String,

    /// HTTPS request method.
    pub method: https::HttpsMethod,

    /// HTTPS headers to be used in the request.
    pub headers: Vec<https::HttpsHeader>,

    /// HTTPS body to be used in the request.
    pub body: ByteBuf,
}
impl From<https::HttpsRequest> for HttpsRequest {
    fn from(request: https::HttpsRequest) -> Self {
        Self {
            timeout_ms: request
                .timeout
                .as_millis()
                .try_into()
                .expect("timeout should not exceed a u32"),
            url: request.url,
            method: request.method,
            headers: request.headers,
            body: ByteBuf::from(request.body),
        }
    }
}

/// Binding version of [`https::HttpsResponse`].
#[derive(Tsify, Deserialize)]
#[serde(rename_all = "camelCase")]
#[tsify(from_wasm_abi)]
pub struct HttpsResponse {
    /// HTTPS response status code.
    pub status: u16,

    /// HTTPS body of the response.
    pub body: ByteBuf,
}

/// Binding version of [`https::HttpsResult`].
#[derive(Tsify, Deserialize)]
#[serde(
    tag = "type",
    content = "result",
    rename_all = "kebab-case",
    rename_all_fields = "camelCase"
)]
#[tsify(from_wasm_abi)]
pub enum HttpsResult {
    /// Contains the HTTPS response.
    Response(HttpsResponse),

    /// Contains the HTTPS error.
    Error(HttpsError),
}

#[duplicate_item(
    response_type;
    [ RemoteSecretSetupResponse ];
    [ RemoteSecretMonitorResponse ];
)]
impl From<HttpsResult> for response_type {
    fn from(response: HttpsResult) -> Self {
        let result = match response {
            HttpsResult::Response(https_response) => Ok(https::HttpsResponse {
                status: https_response.status,
                body: https_response.body.to_vec(),
            }),
            HttpsResult::Error(https_error) => Err(https_error),
        };

        Self { result }
    }
}

Messung V0.5 in Prozent
C=87 H=100 G=93

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-28) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik