Worker does not cache POST method

Hi, I’m trying to make a cache service for several APIs, but after play around with the POST request example (https://developers.cloudflare.com/workers/examples/cache-post-request),
seem like cloudflare could not save the cache for POST method.
cache.match result is always undefined and CF-Cache-Status always equal DYNAMIC

Do your guys have any ideas? Thanks.

async function sha256(message) {
    // encode as UTF-8
    const msgBuffer = new TextEncoder().encode(message)

    // hash the message
    const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer)

    // convert ArrayBuffer to Array
    const hashArray = Array.from(new Uint8Array(hashBuffer))

    // convert bytes to hex string
    const hashHex = hashArray.map(b => ("00" + b.toString(16)).slice(-2)).join("")
    return hashHex
}

async function handlePostRequest(event) {
    const request = event.request
    const body = await request.clone().text()

    // Hash the request body to use it as a part of the cache key
    const hash = await sha256(body || '')
    const cacheUrl = new URL(request.url)

    // Store the URL in cache by prepending the body's hash
    cacheUrl.pathname = "/posts" + cacheUrl.pathname + hash

    // Convert to a GET to be able to cache
    const cacheKey = new Request(cacheUrl.toString(), {
        // headers: request.headers,
        method: "GET",
    })

    const cache = caches.default

    // Find the cache key in the cache
    let response = await cache.match(cacheKey)

    // Otherwise, fetch response to POST request from origin
    if (!response) {
        response = await fetch(`https://6081462b73292b0017cdd24c.mockapi.io/user`, {
            // cf: { cacheEverything: true, cacheKey: cacheUrl.toString() },
            method: 'POST',
            headers: request.headers,
            body: request.body
        })

        event.waitUntil(cache.put(cacheKey, response.clone()))
    }
    return response
}

addEventListener("fetch", event => {
    try {
        const request = event.request
        if (request.method.toUpperCase() === "POST")
            return event.respondWith(handlePostRequest(event))
        return event.respondWith(fetch(request))
    } catch (e) {
        return event.respondWith(new Response("Error thrown " + e.message))
    }
})

I already know what is wrong here, I’m trying to use form data with post request and the boundary in header changed every time a request sent, so the body and the hash changes every request
Content-Type:multipart/form-data; boundary=<calculated when request is sent>

This change will solve the problem

    const body = await request.clone().text()

to

    const body = [...(await request.clone().formData()).entries()].toString()

and remember not store headers in cacheKey (or you should remove Content type header first)