m
Size: a a a
m
m
MO
Д
Д
Д
m
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
const Endpoint = "https://zeapi.yandex.net:443/lab/api/yalm/text3"
type Question struct {
Query string `json:"query"`
Intro uint `json:"intro"`
Filter uint `json:"filter"`
}
func main() {
body := Question{
Query: "Vdsina",
Intro: 0,
Filter: 1,
}
bodyBytes, err := json.Marshal(body)
if err != nil {
panic(err)
}
fmt.Println(string(bodyBytes))
req, err := http.NewRequest(http.MethodPost, Endpoint, bytes.NewReader(bodyBytes))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
bodyResp, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
err = resp.Body.Close()
if err != nil {
panic(err)
}
fmt.Println("response Body:", string(bodyResp))
}
m
Host
— req.Host = "zeapi.yandex.net:443"
m
m
MO
🤔
🤔
🤔
A
🤔
Mk
A
🤔