Skip to content

Commit 4a4f561

Browse files
committed
docs(ic-asset-certification): improve clarity in readme.md
1 parent 358977c commit 4a4f561

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/http-certification/assets/README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn post_upgrade() {
7676

7777
## Canister endpoints
7878

79-
There is only one canister endpoint in this example to serve assets, `http_request` query endpoint. The `serve_metrics` and `serve_asset` functions will be covered in a later section.
79+
There is only one canister endpoint in this example to serve assets, the `http_request` query endpoint. The `http_request` handler uses two auxiliary functions, `serve_metrics` and `serve_asset`, which are covered in a later section.
8080

8181
```rust
8282
#[query]
@@ -160,18 +160,17 @@ The `certify_all_assets` function performs the following steps:
160160
4. Certify the assets using the `certify_assets` function from the `ic-asset-certification` crate.
161161
5. Set the canister's certified data.
162162

163-
````rust
163+
```rust
164164
thread_local! {
165165
static HTTP_TREE: Rc<RefCell<HttpCertificationTree>> = Default::default();
166166

167+
static ASSET_ROUTER: RefCell<AssetRouter<'static>> = RefCell::new(AssetRouter::with_tree(HTTP_TREE.with(|tree| tree.clone())));
168+
167169
// initializing the asset router with an HTTP certification tree is optional.
168170
// if direct access to the HTTP certification tree is not needed for certifying
169171
// requests and responses outside of the asset router, then this step can be skipped
170172
// and the asset router can be initialized like so:
171-
// ```
172-
// static ASSET_ROUTER: RefCell<AssetRouter<'static>> = Default::default();
173-
// ```
174-
static ASSET_ROUTER: RefCell<AssetRouter<'static>> = RefCell::new(AssetRouter::with_tree(HTTP_TREE.with(|tree| tree.clone())));
173+
static ASSET_ROUTER: RefCell<AssetRouter<'static>> = Default::default();
175174
}
176175

177176
const IMMUTABLE_ASSET_CACHE_CONTROL: &str = "public, max-age=31536000, immutable";
@@ -267,7 +266,7 @@ fn certify_all_assets() {
267266
set_certified_data(&asset_router.root_hash());
268267
});
269268
}
270-
````
269+
```
271270

272271
## Serving assets
273272

0 commit comments

Comments
 (0)