mirror of https://bitbucket.org/ausocean/av.git
protocol/rtsp: using string literals for request methods
This commit is contained in:
parent
2f752d5b7f
commit
07e7235dc4
|
@ -61,7 +61,7 @@ func NewClient(addr string) (*Client, error) {
|
|||
|
||||
// Describe forms and sends an RTSP request of method DESCRIBE to the RTSP server.
|
||||
func (c *Client) Describe() (*Response, error) {
|
||||
req, err := NewRequest(describe, c.nextCSeq(), c.url, nil)
|
||||
req, err := NewRequest("DESCRIBE", c.nextCSeq(), c.url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func (c *Client) Describe() (*Response, error) {
|
|||
|
||||
// Options forms and sends an RTSP request of method OPTIONS to the RTSP server.
|
||||
func (c *Client) Options() (*Response, error) {
|
||||
req, err := NewRequest(options, c.nextCSeq(), c.url, nil)
|
||||
req, err := NewRequest("OPTIONS", c.nextCSeq(), c.url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ func (c *Client) Setup(track, transport string) (*Response, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
req, err := NewRequest(setup, c.nextCSeq(), url, nil)
|
||||
req, err := NewRequest("SETUP", c.nextCSeq(), url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ func (c *Client) Setup(track, transport string) (*Response, error) {
|
|||
|
||||
// Play forms and sends an RTSP request of method PLAY to the RTSP server
|
||||
func (c *Client) Play() (*Response, error) {
|
||||
req, err := NewRequest(play, c.nextCSeq(), c.url, nil)
|
||||
req, err := NewRequest("PLAY", c.nextCSeq(), c.url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -69,14 +69,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// RTSP methods.
|
||||
const (
|
||||
describe = "DESCRIBE"
|
||||
options = "OPTIONS"
|
||||
play = "PLAY"
|
||||
setup = "SETUP"
|
||||
)
|
||||
|
||||
// Minimum response size to be considered valid.
|
||||
const minResponse = 2
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ func TestMethods(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
method: func(c *Client) (*Response, error) {
|
||||
req, err := NewRequest(describe, c.nextCSeq(), url, nil)
|
||||
req, err := NewRequest("DESCRIBE", c.nextCSeq(), url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ func TestMethods(t *testing.T) {
|
|||
},
|
||||
{
|
||||
method: func(c *Client) (*Response, error) {
|
||||
req, err := NewRequest(options, c.nextCSeq(), url, nil)
|
||||
req, err := NewRequest("OPTIONS", c.nextCSeq(), url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ func TestMethods(t *testing.T) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
req, err := NewRequest(setup, c.nextCSeq(), u, nil)
|
||||
req, err := NewRequest("SETUP", c.nextCSeq(), u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func TestMethods(t *testing.T) {
|
|||
},
|
||||
{
|
||||
method: func(c *Client) (*Response, error) {
|
||||
req, err := NewRequest(play, c.nextCSeq(), url, nil)
|
||||
req, err := NewRequest("PLAY", c.nextCSeq(), url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue