Golang net/http.ParseHTTPVersion() function example

package net/http

Golang net/http.ParseHTTPVersion() function usage example

 package main

 import (
  "fmt"
  "net/http"
 )

 func main() {
  fmt.Println("Hello, playground")
  major, minor, ok := http.ParseHTTPVersion("HTTP/1.0")

  fmt.Printf("major : %d, minor : %d, ok : %v", major, minor, ok)
 }

Output :

Hello, playground

major : 1, minor : 0, ok : true

Reference :

http://golang.org/pkg/net/http/#ParseHTTPVersion

Advertisement