handler_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. package api
  2. import (
  3. "bytes"
  4. "context"
  5. "encoding/json"
  6. "encoding/pem"
  7. "fmt"
  8. "io/ioutil"
  9. "net/http/httptest"
  10. "net/url"
  11. "testing"
  12. "time"
  13. "github.com/go-chi/chi"
  14. "github.com/smallstep/assert"
  15. "github.com/smallstep/certificates/acme"
  16. "go.step.sm/crypto/jose"
  17. "go.step.sm/crypto/pemutil"
  18. )
  19. func TestHandler_GetNonce(t *testing.T) {
  20. tests := []struct {
  21. name string
  22. statusCode int
  23. }{
  24. {"GET", 204},
  25. {"HEAD", 200},
  26. }
  27. // Request with chi context
  28. req := httptest.NewRequest("GET", "http://ca.smallstep.com/nonce", nil)
  29. for _, tt := range tests {
  30. t.Run(tt.name, func(t *testing.T) {
  31. h := &Handler{}
  32. w := httptest.NewRecorder()
  33. req.Method = tt.name
  34. h.GetNonce(w, req)
  35. res := w.Result()
  36. if res.StatusCode != tt.statusCode {
  37. t.Errorf("Handler.GetNonce StatusCode = %d, wants %d", res.StatusCode, tt.statusCode)
  38. }
  39. })
  40. }
  41. }
  42. func TestHandler_GetDirectory(t *testing.T) {
  43. linker := NewLinker("acme", "ca.smallstep.com")
  44. prov := newProv()
  45. provName := url.PathEscape(prov.GetName())
  46. baseURL := &url.URL{Scheme: "https", Host: "test.ca.smallstep.com"}
  47. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  48. ctx = context.WithValue(ctx, baseURLContextKey, baseURL)
  49. expDir := Directory{
  50. NewNonce: fmt.Sprintf("%s/acme/%s/new-nonce", baseURL.String(), provName),
  51. NewAccount: fmt.Sprintf("%s/acme/%s/new-account", baseURL.String(), provName),
  52. NewOrder: fmt.Sprintf("%s/acme/%s/new-order", baseURL.String(), provName),
  53. RevokeCert: fmt.Sprintf("%s/acme/%s/revoke-cert", baseURL.String(), provName),
  54. KeyChange: fmt.Sprintf("%s/acme/%s/key-change", baseURL.String(), provName),
  55. }
  56. type test struct {
  57. statusCode int
  58. err *acme.Error
  59. }
  60. var tests = map[string]func(t *testing.T) test{
  61. "ok": func(t *testing.T) test {
  62. return test{
  63. statusCode: 200,
  64. }
  65. },
  66. }
  67. for name, run := range tests {
  68. tc := run(t)
  69. t.Run(name, func(t *testing.T) {
  70. h := &Handler{linker: linker}
  71. req := httptest.NewRequest("GET", "/foo/bar", nil)
  72. req = req.WithContext(ctx)
  73. w := httptest.NewRecorder()
  74. h.GetDirectory(w, req)
  75. res := w.Result()
  76. assert.Equals(t, res.StatusCode, tc.statusCode)
  77. body, err := ioutil.ReadAll(res.Body)
  78. res.Body.Close()
  79. assert.FatalError(t, err)
  80. if res.StatusCode >= 400 && assert.NotNil(t, tc.err) {
  81. var ae acme.Error
  82. assert.FatalError(t, json.Unmarshal(bytes.TrimSpace(body), &ae))
  83. assert.Equals(t, ae.Type, tc.err.Type)
  84. assert.Equals(t, ae.Detail, tc.err.Detail)
  85. assert.Equals(t, ae.Identifier, tc.err.Identifier)
  86. assert.Equals(t, ae.Subproblems, tc.err.Subproblems)
  87. assert.Equals(t, res.Header["Content-Type"], []string{"application/problem+json"})
  88. } else {
  89. var dir Directory
  90. json.Unmarshal(bytes.TrimSpace(body), &dir)
  91. assert.Equals(t, dir, expDir)
  92. assert.Equals(t, res.Header["Content-Type"], []string{"application/json"})
  93. }
  94. })
  95. }
  96. }
  97. func TestHandler_GetAuthz(t *testing.T) {
  98. expiry := time.Now().UTC().Add(6 * time.Hour)
  99. az := acme.Authorization{
  100. ID: "authzID",
  101. Identifier: acme.Identifier{
  102. Type: "dns",
  103. Value: "example.com",
  104. },
  105. Status: "pending",
  106. Expires: expiry,
  107. Wildcard: false,
  108. Challenges: []*acme.Challenge{
  109. {
  110. Type: "http-01",
  111. Status: "pending",
  112. Token: "tok2",
  113. URL: "https://ca.smallstep.com/acme/challenge/chHTTPID",
  114. ID: "chHTTP01ID",
  115. AuthzID: "authzID",
  116. },
  117. {
  118. Type: "dns-01",
  119. Status: "pending",
  120. Token: "tok2",
  121. URL: "https://ca.smallstep.com/acme/challenge/chDNSID",
  122. ID: "chDNSID",
  123. AuthzID: "authzID",
  124. },
  125. },
  126. }
  127. prov := newProv()
  128. provName := url.PathEscape(prov.GetName())
  129. baseURL := &url.URL{Scheme: "https", Host: "test.ca.smallstep.com"}
  130. // Request with chi context
  131. chiCtx := chi.NewRouteContext()
  132. chiCtx.URLParams.Add("authzID", az.ID)
  133. url := fmt.Sprintf("%s/acme/%s/challenge/%s",
  134. baseURL.String(), provName, az.ID)
  135. type test struct {
  136. db acme.DB
  137. ctx context.Context
  138. statusCode int
  139. err *acme.Error
  140. }
  141. var tests = map[string]func(t *testing.T) test{
  142. "fail/no-account": func(t *testing.T) test {
  143. return test{
  144. db: &acme.MockDB{},
  145. ctx: context.Background(),
  146. statusCode: 400,
  147. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  148. }
  149. },
  150. "fail/nil-account": func(t *testing.T) test {
  151. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  152. ctx = context.WithValue(ctx, accContextKey, nil)
  153. return test{
  154. db: &acme.MockDB{},
  155. ctx: ctx,
  156. statusCode: 400,
  157. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  158. }
  159. },
  160. "fail/getAuthz-error": func(t *testing.T) test {
  161. acc := &acme.Account{ID: "accID"}
  162. ctx := context.WithValue(context.Background(), accContextKey, acc)
  163. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  164. return test{
  165. db: &acme.MockDB{
  166. MockError: acme.NewErrorISE("force"),
  167. },
  168. ctx: ctx,
  169. statusCode: 500,
  170. err: acme.NewErrorISE("force"),
  171. }
  172. },
  173. "ok": func(t *testing.T) test {
  174. acc := &acme.Account{ID: "accID"}
  175. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  176. ctx = context.WithValue(ctx, accContextKey, acc)
  177. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  178. ctx = context.WithValue(ctx, baseURLContextKey, baseURL)
  179. return test{
  180. db: &acme.MockDB{
  181. MockGetAuthorization: func(ctx context.Context, id string) (*acme.Authorization, error) {
  182. assert.Equals(t, id, az.ID)
  183. return &az, nil
  184. },
  185. /*
  186. getLink: func(ctx context.Context, typ acme.Link, abs bool, in ...string) string {
  187. assert.Equals(t, typ, acme.AuthzLink)
  188. assert.Equals(t, acme.BaseURLFromContext(ctx), baseURL)
  189. assert.True(t, abs)
  190. assert.Equals(t, in, []string{az.ID})
  191. return url
  192. },
  193. */
  194. },
  195. ctx: ctx,
  196. statusCode: 200,
  197. }
  198. },
  199. }
  200. for name, run := range tests {
  201. tc := run(t)
  202. t.Run(name, func(t *testing.T) {
  203. h := &Handler{db: tc.db}
  204. req := httptest.NewRequest("GET", "/foo/bar", nil)
  205. req = req.WithContext(tc.ctx)
  206. w := httptest.NewRecorder()
  207. h.GetAuthorization(w, req)
  208. res := w.Result()
  209. assert.Equals(t, res.StatusCode, tc.statusCode)
  210. body, err := ioutil.ReadAll(res.Body)
  211. res.Body.Close()
  212. assert.FatalError(t, err)
  213. if res.StatusCode >= 400 && assert.NotNil(t, tc.err) {
  214. var ae acme.Error
  215. assert.FatalError(t, json.Unmarshal(bytes.TrimSpace(body), &ae))
  216. assert.Equals(t, ae.Type, tc.err.Type)
  217. assert.Equals(t, ae.Detail, tc.err.Detail)
  218. assert.Equals(t, ae.Identifier, tc.err.Identifier)
  219. assert.Equals(t, ae.Subproblems, tc.err.Subproblems)
  220. assert.Equals(t, res.Header["Content-Type"], []string{"application/problem+json"})
  221. } else {
  222. //var gotAz acme.Authz
  223. //assert.FatalError(t, json.Unmarshal(bytes.TrimSpace(body), &gotAz))
  224. expB, err := json.Marshal(az)
  225. assert.FatalError(t, err)
  226. assert.Equals(t, bytes.TrimSpace(body), expB)
  227. assert.Equals(t, res.Header["Location"], []string{url})
  228. assert.Equals(t, res.Header["Content-Type"], []string{"application/json"})
  229. }
  230. })
  231. }
  232. }
  233. func TestHandler_GetCertificate(t *testing.T) {
  234. leaf, err := pemutil.ReadCertificate("../../authority/testdata/certs/foo.crt")
  235. assert.FatalError(t, err)
  236. inter, err := pemutil.ReadCertificate("../../authority/testdata/certs/intermediate_ca.crt")
  237. assert.FatalError(t, err)
  238. root, err := pemutil.ReadCertificate("../../authority/testdata/certs/root_ca.crt")
  239. assert.FatalError(t, err)
  240. certBytes := append(pem.EncodeToMemory(&pem.Block{
  241. Type: "CERTIFICATE",
  242. Bytes: leaf.Raw,
  243. }), pem.EncodeToMemory(&pem.Block{
  244. Type: "CERTIFICATE",
  245. Bytes: inter.Raw,
  246. })...)
  247. certBytes = append(certBytes, pem.EncodeToMemory(&pem.Block{
  248. Type: "CERTIFICATE",
  249. Bytes: root.Raw,
  250. })...)
  251. certID := "certID"
  252. prov := newProv()
  253. provName := url.PathEscape(prov.GetName())
  254. baseURL := &url.URL{Scheme: "https", Host: "test.ca.smallstep.com"}
  255. // Request with chi context
  256. chiCtx := chi.NewRouteContext()
  257. chiCtx.URLParams.Add("certID", certID)
  258. url := fmt.Sprintf("%s/acme/%s/certificate/%s",
  259. baseURL.String(), provName, certID)
  260. type test struct {
  261. db acme.DB
  262. ctx context.Context
  263. statusCode int
  264. err *acme.Error
  265. }
  266. var tests = map[string]func(t *testing.T) test{
  267. "fail/no-account": func(t *testing.T) test {
  268. return test{
  269. db: &acme.MockDB{},
  270. ctx: context.Background(),
  271. statusCode: 400,
  272. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  273. }
  274. },
  275. "fail/nil-account": func(t *testing.T) test {
  276. ctx := context.WithValue(context.Background(), accContextKey, nil)
  277. return test{
  278. db: &acme.MockDB{},
  279. ctx: ctx,
  280. statusCode: 400,
  281. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  282. }
  283. },
  284. "fail/getCertificate-error": func(t *testing.T) test {
  285. acc := &acme.Account{ID: "accID"}
  286. ctx := context.WithValue(context.Background(), accContextKey, acc)
  287. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  288. return test{
  289. db: &acme.MockDB{
  290. MockError: acme.NewErrorISE("force"),
  291. },
  292. ctx: ctx,
  293. statusCode: 500,
  294. err: acme.NewErrorISE("force"),
  295. }
  296. },
  297. "fail/decode-leaf-for-loggger": func(t *testing.T) test {
  298. acc := &acme.Account{ID: "accID"}
  299. ctx := context.WithValue(context.Background(), accContextKey, acc)
  300. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  301. return test{
  302. db: &acme.MockDB{
  303. MockGetCertificate: func(ctx context.Context, id string) (*acme.Certificate, error) {
  304. assert.Equals(t, id, certID)
  305. return &acme.Certificate{}, nil
  306. },
  307. },
  308. ctx: ctx,
  309. statusCode: 500,
  310. err: acme.NewErrorISE("failed to decode any certificates from generated certBytes"),
  311. }
  312. },
  313. "fail/parse-x509-leaf-for-logger": func(t *testing.T) test {
  314. acc := &acme.Account{ID: "accID"}
  315. ctx := context.WithValue(context.Background(), accContextKey, acc)
  316. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  317. return test{
  318. db: &acme.MockDB{
  319. MockGetCertificate: func(ctx context.Context, id string) (*acme.Certificate, error) {
  320. assert.Equals(t, id, certID)
  321. return &acme.Certificate{}, nil
  322. },
  323. },
  324. ctx: ctx,
  325. statusCode: 500,
  326. err: acme.NewErrorISE("failed to parse generated leaf certificate"),
  327. }
  328. },
  329. "ok": func(t *testing.T) test {
  330. acc := &acme.Account{ID: "accID"}
  331. ctx := context.WithValue(context.Background(), accContextKey, acc)
  332. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  333. return test{
  334. db: &acme.MockDB{
  335. MockGetCertificate: func(ctx context.Context, id string) (*acme.Certificate, error) {
  336. assert.Equals(t, id, certID)
  337. return &acme.Certificate{}, nil
  338. },
  339. },
  340. ctx: ctx,
  341. statusCode: 200,
  342. }
  343. },
  344. }
  345. for name, run := range tests {
  346. tc := run(t)
  347. t.Run(name, func(t *testing.T) {
  348. h := &Handler{db: tc.db}
  349. req := httptest.NewRequest("GET", url, nil)
  350. req = req.WithContext(tc.ctx)
  351. w := httptest.NewRecorder()
  352. h.GetCertificate(w, req)
  353. res := w.Result()
  354. assert.Equals(t, res.StatusCode, tc.statusCode)
  355. body, err := ioutil.ReadAll(res.Body)
  356. res.Body.Close()
  357. assert.FatalError(t, err)
  358. if res.StatusCode >= 400 && assert.NotNil(t, tc.err) {
  359. var ae acme.Error
  360. assert.FatalError(t, json.Unmarshal(bytes.TrimSpace(body), &ae))
  361. assert.Equals(t, ae.Type, tc.err.Type)
  362. assert.HasPrefix(t, ae.Detail, tc.err.Detail)
  363. assert.Equals(t, ae.Identifier, tc.err.Identifier)
  364. assert.Equals(t, ae.Subproblems, tc.err.Subproblems)
  365. assert.Equals(t, res.Header["Content-Type"], []string{"application/problem+json"})
  366. } else {
  367. assert.Equals(t, bytes.TrimSpace(body), bytes.TrimSpace(certBytes))
  368. assert.Equals(t, res.Header["Content-Type"], []string{"application/pem-certificate-chain; charset=utf-8"})
  369. }
  370. })
  371. }
  372. }
  373. func ch() acme.Challenge {
  374. return acme.Challenge{
  375. Type: "http-01",
  376. Status: "pending",
  377. Token: "tok2",
  378. URL: "https://ca.smallstep.com/acme/challenge/chID",
  379. ID: "chID",
  380. AuthzID: "authzID",
  381. }
  382. }
  383. func TestHandlerGetChallenge(t *testing.T) {
  384. chiCtx := chi.NewRouteContext()
  385. chiCtx.URLParams.Add("chID", "chID")
  386. prov := newProv()
  387. provName := url.PathEscape(prov.GetName())
  388. baseURL := &url.URL{Scheme: "https", Host: "test.ca.smallstep.com"}
  389. url := fmt.Sprintf("%s/acme/challenge/%s", baseURL, "chID")
  390. type test struct {
  391. db acme.DB
  392. ctx context.Context
  393. statusCode int
  394. ch acme.Challenge
  395. err *acme.Error
  396. }
  397. var tests = map[string]func(t *testing.T) test{
  398. "fail/no-account": func(t *testing.T) test {
  399. return test{
  400. ctx: context.Background(),
  401. statusCode: 400,
  402. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  403. }
  404. },
  405. "fail/nil-account": func(t *testing.T) test {
  406. return test{
  407. ctx: context.WithValue(context.Background(), accContextKey, nil),
  408. statusCode: 400,
  409. err: acme.NewError(acme.ErrorAccountDoesNotExistType, "account does not exist"),
  410. }
  411. },
  412. "fail/no-payload": func(t *testing.T) test {
  413. acc := &acme.Account{ID: "accID"}
  414. ctx := context.WithValue(context.Background(), accContextKey, acc)
  415. return test{
  416. ctx: ctx,
  417. statusCode: 500,
  418. err: acme.NewErrorISE("payload expected in request context"),
  419. }
  420. },
  421. "fail/nil-payload": func(t *testing.T) test {
  422. acc := &acme.Account{ID: "accID"}
  423. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  424. ctx = context.WithValue(ctx, accContextKey, acc)
  425. ctx = context.WithValue(ctx, payloadContextKey, nil)
  426. return test{
  427. ctx: ctx,
  428. statusCode: 500,
  429. err: acme.NewErrorISE("payload expected in request context"),
  430. }
  431. },
  432. "fail/validate-challenge-error": func(t *testing.T) test {
  433. acc := &acme.Account{ID: "accID"}
  434. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  435. ctx = context.WithValue(ctx, accContextKey, acc)
  436. ctx = context.WithValue(ctx, payloadContextKey, &payloadInfo{isEmptyJSON: true})
  437. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  438. return test{
  439. db: &acme.MockDB{
  440. MockError: acme.NewError(acme.ErrorUnauthorizedType, "unauthorized"),
  441. },
  442. ctx: ctx,
  443. statusCode: 401,
  444. err: acme.NewError(acme.ErrorUnauthorizedType, "unauthorized"),
  445. }
  446. },
  447. "fail/get-challenge-error": func(t *testing.T) test {
  448. acc := &acme.Account{ID: "accID"}
  449. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  450. ctx = context.WithValue(ctx, accContextKey, acc)
  451. ctx = context.WithValue(ctx, payloadContextKey, &payloadInfo{isPostAsGet: true})
  452. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  453. return test{
  454. db: &acme.MockDB{
  455. MockError: acme.NewError(acme.ErrorUnauthorizedType, "unauthorized"),
  456. },
  457. ctx: ctx,
  458. statusCode: 401,
  459. err: acme.NewError(acme.ErrorUnauthorizedType, "unauthorized"),
  460. }
  461. },
  462. "ok/validate-challenge": func(t *testing.T) test {
  463. key, err := jose.GenerateJWK("EC", "P-256", "ES256", "sig", "", 0)
  464. assert.FatalError(t, err)
  465. acc := &acme.Account{ID: "accID", Key: key}
  466. ctx := context.WithValue(context.Background(), provisionerContextKey, prov)
  467. ctx = context.WithValue(ctx, accContextKey, acc)
  468. ctx = context.WithValue(ctx, payloadContextKey, &payloadInfo{isEmptyJSON: true})
  469. ctx = context.WithValue(ctx, chi.RouteCtxKey, chiCtx)
  470. ctx = context.WithValue(ctx, baseURLContextKey, baseURL)
  471. ch := ch()
  472. ch.Status = "valid"
  473. ch.Validated = time.Now().UTC().Format(time.RFC3339)
  474. return test{
  475. db: &acme.MockDB{
  476. MockGetChallenge: func(ctx context.Context, chID, azID string) (*acme.Challenge, error) {
  477. assert.Equals(t, chID, ch.ID)
  478. return &ch, nil
  479. },
  480. /*
  481. getLink: func(ctx context.Context, typ acme.Link, abs bool, in ...string) string {
  482. var ret string
  483. switch count {
  484. case 0:
  485. assert.Equals(t, typ, acme.AuthzLink)
  486. assert.True(t, abs)
  487. assert.Equals(t, in, []string{ch.AuthzID})
  488. ret = fmt.Sprintf("%s/acme/%s/authz/%s", baseURL.String(), provName, ch.AuthzID)
  489. case 1:
  490. assert.Equals(t, typ, acme.ChallengeLink)
  491. assert.True(t, abs)
  492. assert.Equals(t, in, []string{ch.ID})
  493. ret = url
  494. }
  495. count++
  496. return ret
  497. },
  498. */
  499. },
  500. ctx: ctx,
  501. statusCode: 200,
  502. ch: ch,
  503. }
  504. },
  505. }
  506. for name, run := range tests {
  507. tc := run(t)
  508. t.Run(name, func(t *testing.T) {
  509. h := &Handler{db: tc.db}
  510. req := httptest.NewRequest("GET", url, nil)
  511. req = req.WithContext(tc.ctx)
  512. w := httptest.NewRecorder()
  513. h.GetChallenge(w, req)
  514. res := w.Result()
  515. assert.Equals(t, res.StatusCode, tc.statusCode)
  516. body, err := ioutil.ReadAll(res.Body)
  517. res.Body.Close()
  518. assert.FatalError(t, err)
  519. if res.StatusCode >= 400 && assert.NotNil(t, tc.err) {
  520. var ae acme.Error
  521. assert.FatalError(t, json.Unmarshal(bytes.TrimSpace(body), &ae))
  522. assert.Equals(t, ae.Type, tc.err.Type)
  523. assert.Equals(t, ae.Detail, tc.err.Detail)
  524. assert.Equals(t, ae.Identifier, tc.err.Identifier)
  525. assert.Equals(t, ae.Subproblems, tc.err.Subproblems)
  526. assert.Equals(t, res.Header["Content-Type"], []string{"application/problem+json"})
  527. } else {
  528. expB, err := json.Marshal(tc.ch)
  529. assert.FatalError(t, err)
  530. assert.Equals(t, bytes.TrimSpace(body), expB)
  531. assert.Equals(t, res.Header["Link"], []string{fmt.Sprintf("<%s/acme/%s/authz/%s>;rel=\"up\"", baseURL, provName, tc.ch.AuthzID)})
  532. assert.Equals(t, res.Header["Location"], []string{url})
  533. assert.Equals(t, res.Header["Content-Type"], []string{"application/json"})
  534. }
  535. })
  536. }
  537. }