|
...
|
...
|
@@ -2,6 +2,7 @@ package aliyun |
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"net/url"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
...
|
...
|
@@ -15,3 +16,28 @@ func Test_GetFile(t *testing.T) { |
|
|
|
n, _ := buf.ReadFrom(io)
|
|
|
|
t.Log("read from reader:", n)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_FileUrl(t *testing.T) {
|
|
|
|
input := []struct {
|
|
|
|
Module string
|
|
|
|
Input string
|
|
|
|
Except string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
Module: "UrlParse",
|
|
|
|
Input: "http://mmm-opp-dev.fjmaimaimai.com/file/opp/image/20200106/1578297295_RxJscRHCzQmxeseTAEQXTH7A7ZK6z4Fz.jpg",
|
|
|
|
Except: "/file/opp/image/20200106/1578297295_RxJscRHCzQmxeseTAEQXTH7A7ZK6z4Fz.jpg",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
urlIn := input[0]
|
|
|
|
urlRaw, err := url.Parse(urlIn.Input)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if urlRaw.Path != urlIn.Except {
|
|
|
|
t.Fatal(urlIn.Module, "Input:", urlIn.Input, "Out:", urlRaw.Path, "Except:", urlIn.Except)
|
|
|
|
}
|
|
|
|
urlRaw.Scheme = "https"
|
|
|
|
//t.Log(urlRaw.String())
|
|
|
|
} |
...
|
...
|
|