bigskysoftware / bigskysoftware/htmx

<image> response for <svg> is transformed into <img>

Open
#2,761 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

I have an svg with an `` tag like this:
```






```

The response of `POST /doSomething` is another ``:
```

```

However, the result is that inside the ``, an `` element is placed, instead of ``:

**Result**:
```

```

**Expected**:
```

```

Minimal server to showcase the behaviour:
```
package main

import (
"fmt"
"log"
"net/http"
)

func homeHandler(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
fmt.Fprintf(w, `







`)
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
}

func doSomethingHandler(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "POST":
fmt.Fprintf(w, `
`)
default:
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
}

func main() {
http.HandleFunc("/", homeHandler)
http.HandleFunc("/doSomething", doSomethingHandler)

fmt.Println("Server is running at http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.