Skip to content

Commit

Permalink
const xmlCommandPrefix and xmlCommandSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
ydnar committed Aug 27, 2015
1 parent 09b62e0 commit d7885e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions check.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c *Conn) CheckDomain(domains ...string) (*DomainCheckResponse, error) {

func encodeDomainCheck(buf *bytes.Buffer, domains []string, extFee bool) error {
buf.Reset()
buf.Write(xmlCommandPrefix)
buf.WriteString(xmlCommandPrefix)
buf.WriteString(`<check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">`)
for _, domain := range domains {
buf.WriteString(`<domain:check><domain:name>`)
Expand Down Expand Up @@ -55,7 +55,7 @@ func encodeDomainCheck(buf *bytes.Buffer, domains []string, extFee bool) error {
buf.WriteString(`</extension>`)
}

buf.Write(xmlCommandSuffix)
buf.WriteString(xmlCommandSuffix)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *Conn) writeLogin(user, password, newPassword string) error {

func encodeLogin(buf *bytes.Buffer, user, password, newPassword, version, language string, objects, extensions []string) error {
buf.Reset()
buf.Write(xmlCommandPrefix)
buf.WriteString(xmlCommandPrefix)
buf.WriteString(`<login><clID>`)
xml.EscapeText(buf, []byte(user))
buf.WriteString(`</clID><pw>`)
Expand Down Expand Up @@ -63,6 +63,6 @@ func encodeLogin(buf *bytes.Buffer, user, password, newPassword, version, langua
buf.WriteString(`</svcExtension>`)
}
buf.WriteString(`</svcs></login>`)
buf.Write(xmlCommandSuffix)
buf.WriteString(xmlCommandSuffix)
return nil
}
14 changes: 4 additions & 10 deletions xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ package epp
import "encoding/xml"

const (
startEPP = `<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">`
endEPP = `</epp>`
)

var (
xmlHeader = []byte(xml.Header)
xmlPrefix = []byte(xml.Header + startEPP)
xmlSuffix = []byte(endEPP)
xmlCommandPrefix = []byte(xml.Header + startEPP + `<command>`)
xmlCommandSuffix = []byte(`</command>` + endEPP)
startEPP = `<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">`
endEPP = `</epp>`
xmlCommandPrefix = xml.Header + startEPP + `<command>`
xmlCommandSuffix = `</command>` + endEPP
)

0 comments on commit d7885e2

Please sign in to comment.