Skip to content

Commit c14cd16

Browse files
feat: add http error
1 parent a58f7de commit c14cd16

39 files changed

Lines changed: 2423 additions & 0 deletions

.github/renovate.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>RustForWeb/.github:renovate-config"]
4+
}

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
17+
env:
18+
RUSTFLAGS: '-Dwarnings'
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
24+
- name: Set up Rust toolchain
25+
uses: actions-rust-lang/setup-rust-toolchain@v1
26+
with:
27+
components: clippy, rustfmt
28+
29+
- name: Install Cargo Binary Install
30+
uses: cargo-bins/cargo-binstall@main
31+
32+
- name: Install crates
33+
run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort
34+
35+
- name: Lint
36+
run: cargo clippy --all-features --all-targets --locked
37+
38+
- name: Check dependencies
39+
run: cargo deny check
40+
41+
- name: Check unused dependencies
42+
run: cargo machete --with-metadata
43+
44+
- name: Check manifest formatting
45+
run: cargo sort --workspace --check
46+
47+
- name: Check formatting
48+
run: cargo fmt --all --check
49+
50+
test:
51+
name: Test
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v6
57+
58+
- name: Set up Rust toolchain
59+
uses: actions-rust-lang/setup-rust-toolchain@v1
60+
with:
61+
components: clippy, rustfmt, rust-src
62+
63+
- name: Test
64+
run: cargo test --all-features --locked --release

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Bump version by semver keyword.'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
release:
20+
name: Release
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Generate GitHub App token
25+
id: app-token
26+
uses: getsentry/action-github-app-token@v3
27+
with:
28+
app_id: ${{ secrets.APP_ID }}
29+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
30+
31+
- name: Checkout
32+
uses: actions/checkout@v6
33+
34+
- name: Set up Rust toolchain
35+
uses: actions-rust-lang/setup-rust-toolchain@v1
36+
37+
- name: Install Cargo Binary Install
38+
uses: cargo-bins/cargo-binstall@main
39+
40+
- name: Install crates
41+
run: cargo binstall --force -y cargo-workspaces toml-cli
42+
43+
- name: Bump version
44+
run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }}
45+
46+
- name: Extract version
47+
id: extract-version
48+
run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT"
49+
50+
- name: Add changes
51+
run: git add .
52+
53+
- name: Commit
54+
uses: dsanders11/github-app-commit-action@v1
55+
with:
56+
message: ${{ steps.extract-version.outputs.VERSION }}
57+
token: ${{ steps.app-token.outputs.token }}
58+
59+
- name: Reset and pull
60+
run: git reset --hard && git pull
61+
62+
- name: Tag
63+
uses: bruno-fs/repo-tagger@1.0.0
64+
with:
65+
tag: ${{ steps.extract-version.outputs.VERSION }}
66+
env:
67+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
68+
69+
- name: Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
generate_release_notes: true
73+
make_latest: true
74+
tag_name: ${{ steps.extract-version.outputs.VERSION }}
75+
token: ${{ steps.app-token.outputs.token }}
76+
77+
- name: Publish
78+
run: cargo workspaces publish --publish-as-is --token "${{ secrets.CRATES_IO_TOKEN }}"

.gitignore

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/rust,node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,node
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
.pnpm-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# Snowpack dependency directory (https://snowpack.dev/)
50+
web_modules/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional stylelint cache
62+
.stylelintcache
63+
64+
# Microbundle cache
65+
.rpt2_cache/
66+
.rts2_cache_cjs/
67+
.rts2_cache_es/
68+
.rts2_cache_umd/
69+
70+
# Optional REPL history
71+
.node_repl_history
72+
73+
# Output of 'npm pack'
74+
*.tgz
75+
76+
# Yarn Integrity file
77+
.yarn-integrity
78+
79+
# dotenv environment variable files
80+
.env
81+
.env.development.local
82+
.env.test.local
83+
.env.production.local
84+
.env.local
85+
86+
# parcel-bundler cache (https://parceljs.org/)
87+
.cache
88+
.parcel-cache
89+
90+
# Next.js build output
91+
.next
92+
out
93+
94+
# Nuxt.js build / generate output
95+
.nuxt
96+
dist
97+
98+
# Gatsby files
99+
.cache/
100+
# Comment in the public line in if your project uses Gatsby and not Next.js
101+
# https://nextjs.org/blog/next-9-1#public-directory-support
102+
# public
103+
104+
# vuepress build output
105+
.vuepress/dist
106+
107+
# vuepress v2.x temp and cache directory
108+
.temp
109+
110+
# Docusaurus cache and generated files
111+
.docusaurus
112+
113+
# Serverless directories
114+
.serverless/
115+
116+
# FuseBox cache
117+
.fusebox/
118+
119+
# DynamoDB Local files
120+
.dynamodb/
121+
122+
# TernJS port file
123+
.tern-port
124+
125+
# Stores VSCode versions used for testing VSCode extensions
126+
.vscode-test
127+
128+
# yarn v2
129+
.yarn/cache
130+
.yarn/unplugged
131+
.yarn/build-state.yml
132+
.yarn/install-state.gz
133+
.pnp.*
134+
135+
### Node Patch ###
136+
# Serverless Webpack directories
137+
.webpack/
138+
139+
# Optional stylelint cache
140+
141+
# SvelteKit build / generate output
142+
.svelte-kit
143+
144+
### Rust ###
145+
# Generated by Cargo
146+
# will have compiled files and executables
147+
debug/
148+
target/
149+
150+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
151+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
152+
# Cargo.lock
153+
154+
# These are backup files generated by rustfmt
155+
**/*.rs.bk
156+
157+
# MSVC Windows builds of rustc generate these, which store debugging information
158+
*.pdb
159+
160+
# End of https://www.toptal.com/developers/gitignore/api/rust,node
161+
162+
# mdBook
163+
book/book/

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-prettier
3+
rev: v3.1.0
4+
hooks:
5+
- id: prettier
6+
language: node
7+
additional_dependencies:
8+
- prettier@^3.4.2
9+
- prettier-plugin-sort-json@^4.1.1
10+
11+
- repo: https://github.com/doublify/pre-commit-rust
12+
rev: v1.0
13+
hooks:
14+
- id: fmt
15+
- id: clippy
16+
args: ['--all-targets', '--all-features', '--', '-D', 'warnings']
17+
18+
- repo: https://github.com/EmbarkStudios/cargo-deny
19+
rev: 0.19.0
20+
hooks:
21+
- id: cargo-deny
22+
23+
# - repo: https://github.com/bnjbvr/cargo-machete
24+
# rev: ba1bcd4
25+
# hooks:
26+
# - id: cargo-machete
27+
- repo: local
28+
hooks:
29+
- id: cargo-machete
30+
name: cargo-machete
31+
language: rust
32+
entry: cargo machete
33+
args: ['--with-metadata']
34+
types: [file, toml]
35+
files: Cargo\.(toml|lock)
36+
pass_filenames: false
37+
38+
- repo: https://github.com/DevinR528/cargo-sort
39+
rev: v2.0.2
40+
hooks:
41+
- id: cargo-sort
42+
args: ['--workspace']

.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"jsonRecursiveSort": true,
4+
"plugins": ["prettier-plugin-sort-json"],
5+
"printWidth": 120,
6+
"singleQuote": true,
7+
"tabWidth": 4
8+
}

0 commit comments

Comments
 (0)