File: internal.go

package info (click to toggle)
golang-github-getkin-kin-openapi 0.110.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,932 kB
  • sloc: makefile: 3
file content (25 lines) | stat: -rw-r--r-- 464 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package openapi3filter

import (
	"reflect"
	"strings"
)

func parseMediaType(contentType string) string {
	i := strings.IndexByte(contentType, ';')
	if i < 0 {
		return contentType
	}
	return contentType[:i]
}

func isNilValue(value interface{}) bool {
	if value == nil {
		return true
	}
	switch reflect.TypeOf(value).Kind() {
	case reflect.Ptr, reflect.Map, reflect.Array, reflect.Chan, reflect.Slice:
		return reflect.ValueOf(value).IsNil()
	}
	return false
}