Skip to content

Commit

Permalink
add test crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Avery committed Aug 13, 2024
1 parent c2ebf16 commit d92ffad
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/build-test-rustls-platform-verifier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Build test rustls platform verifier

on:
push:
branches:
- main
- rc
- hotfix-rc
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash



jobs:
build-windows:
name: Build Windows
runs-on: windows-2022
steps:
- name: Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Build
run: cargo build -p test-rustls-platform-verifier --release --target=x86_64-pc-windows-msvc

- name: Upload artifact
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: test-rustls-platform-verifier
path: ./target/x86_64-pc-windows-msvc/release/test-rustls-platform-verifier.exe
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/*"]
members = ["crates/*", "test-rustls-platform-verifier"]

# Global settings for all crates should be defined here
[workspace.package]
Expand Down
22 changes: 22 additions & 0 deletions test-rustls-platform-verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "test-rustls-platform-verifier"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
homepage.workspace = true
repository.workspace = true
license-file.workspace = true
keywords.workspace = true


[lints]
workspace = true

[dependencies]
reqwest = { version = "0.12.5", features = [
"rustls-tls-manual-roots",
], default-features = false }
rustls-platform-verifier = "0.3.3"
tokio = { version = "1.39.2", features = ["rt-multi-thread", "macros"] }
env_logger = "0.11.5"
19 changes: 19 additions & 0 deletions test-rustls-platform-verifier/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();

let client = reqwest::Client::builder()
.use_preconfigured_tls(rustls_platform_verifier::tls_config())
.build()
.expect("Build should not fail");
let request = client.get("https://httpbin.org/ip").build()?;
let response = client.execute(request).await?;

let status_code = response.status();
let content = response.text().await?;

println!("status_code = {status_code:?}");
println!("content = {content:?}");

Ok(())
}

0 comments on commit d92ffad

Please sign in to comment.