Micro & pluggable web framework for Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 lines
17KB

  1. // Copyright 2019 The Tango Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package tango
  5. import (
  6. "bytes"
  7. "fmt"
  8. "net/http"
  9. "net/http/httptest"
  10. "testing"
  11. )
  12. type Query1Action struct {
  13. Ctx
  14. }
  15. func (a *Query1Action) Get() string {
  16. v, _ := a.Queries().Int("test")
  17. return fmt.Sprintf("%d", v)
  18. }
  19. func TestQuery1(t *testing.T) {
  20. buff := bytes.NewBufferString("")
  21. recorder := httptest.NewRecorder()
  22. recorder.Body = buff
  23. o := Classic()
  24. o.Get("/", new(Query1Action))
  25. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  26. if err != nil {
  27. t.Error(err)
  28. }
  29. o.ServeHTTP(recorder, req)
  30. expect(t, recorder.Code, http.StatusOK)
  31. refute(t, len(buff.String()), 0)
  32. expect(t, buff.String(), "1")
  33. }
  34. type Query2Action struct {
  35. Ctx
  36. }
  37. func (a *Query2Action) Get() string {
  38. v, _ := a.Queries().Int32("test")
  39. return fmt.Sprintf("%d", v)
  40. }
  41. func TestQuery2(t *testing.T) {
  42. buff := bytes.NewBufferString("")
  43. recorder := httptest.NewRecorder()
  44. recorder.Body = buff
  45. o := Classic()
  46. o.Get("/", new(Query2Action))
  47. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  48. if err != nil {
  49. t.Error(err)
  50. }
  51. o.ServeHTTP(recorder, req)
  52. expect(t, recorder.Code, http.StatusOK)
  53. refute(t, len(buff.String()), 0)
  54. expect(t, buff.String(), "1")
  55. }
  56. type Query3Action struct {
  57. Ctx
  58. }
  59. func (a *Query3Action) Get() string {
  60. v, _ := a.Queries().Int64("test")
  61. return fmt.Sprintf("%d", v)
  62. }
  63. func TestQuery3(t *testing.T) {
  64. buff := bytes.NewBufferString("")
  65. recorder := httptest.NewRecorder()
  66. recorder.Body = buff
  67. o := Classic()
  68. o.Get("/", new(Query3Action))
  69. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  70. if err != nil {
  71. t.Error(err)
  72. }
  73. o.ServeHTTP(recorder, req)
  74. expect(t, recorder.Code, http.StatusOK)
  75. refute(t, len(buff.String()), 0)
  76. expect(t, buff.String(), "1")
  77. }
  78. type Query4Action struct {
  79. Ctx
  80. }
  81. func (a *Query4Action) Get() string {
  82. v, _ := a.Queries().Uint("test")
  83. return fmt.Sprintf("%d", v)
  84. }
  85. func TestQuery4(t *testing.T) {
  86. buff := bytes.NewBufferString("")
  87. recorder := httptest.NewRecorder()
  88. recorder.Body = buff
  89. o := Classic()
  90. o.Get("/", new(Query4Action))
  91. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  92. if err != nil {
  93. t.Error(err)
  94. }
  95. o.ServeHTTP(recorder, req)
  96. expect(t, recorder.Code, http.StatusOK)
  97. refute(t, len(buff.String()), 0)
  98. expect(t, buff.String(), "1")
  99. }
  100. type Query5Action struct {
  101. Ctx
  102. }
  103. func (a *Query5Action) Get() string {
  104. v, _ := a.Queries().Uint32("test")
  105. return fmt.Sprintf("%d", v)
  106. }
  107. func TestQuery5(t *testing.T) {
  108. buff := bytes.NewBufferString("")
  109. recorder := httptest.NewRecorder()
  110. recorder.Body = buff
  111. o := Classic()
  112. o.Get("/", new(Query5Action))
  113. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  114. if err != nil {
  115. t.Error(err)
  116. }
  117. o.ServeHTTP(recorder, req)
  118. expect(t, recorder.Code, http.StatusOK)
  119. refute(t, len(buff.String()), 0)
  120. expect(t, buff.String(), "1")
  121. }
  122. type Query6Action struct {
  123. Ctx
  124. }
  125. func (a *Query6Action) Get() string {
  126. v, _ := a.Queries().Uint64("test")
  127. return fmt.Sprintf("%d", v)
  128. }
  129. func TestQuery6(t *testing.T) {
  130. buff := bytes.NewBufferString("")
  131. recorder := httptest.NewRecorder()
  132. recorder.Body = buff
  133. o := Classic()
  134. o.Get("/", new(Query6Action))
  135. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  136. if err != nil {
  137. t.Error(err)
  138. }
  139. o.ServeHTTP(recorder, req)
  140. expect(t, recorder.Code, http.StatusOK)
  141. refute(t, len(buff.String()), 0)
  142. expect(t, buff.String(), "1")
  143. }
  144. type Query7Action struct {
  145. Ctx
  146. }
  147. func (a *Query7Action) Get() string {
  148. v, _ := a.Queries().Float32("test")
  149. return fmt.Sprintf("%.2f", v)
  150. }
  151. func TestQuery7(t *testing.T) {
  152. buff := bytes.NewBufferString("")
  153. recorder := httptest.NewRecorder()
  154. recorder.Body = buff
  155. o := Classic()
  156. o.Get("/", new(Query7Action))
  157. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  158. if err != nil {
  159. t.Error(err)
  160. }
  161. o.ServeHTTP(recorder, req)
  162. expect(t, recorder.Code, http.StatusOK)
  163. refute(t, len(buff.String()), 0)
  164. expect(t, buff.String(), "1.00")
  165. }
  166. type Query8Action struct {
  167. Ctx
  168. }
  169. func (a *Query8Action) Get() string {
  170. v, _ := a.Queries().Float64("test")
  171. return fmt.Sprintf("%.2f", v)
  172. }
  173. func TestQuery8(t *testing.T) {
  174. buff := bytes.NewBufferString("")
  175. recorder := httptest.NewRecorder()
  176. recorder.Body = buff
  177. o := Classic()
  178. o.Get("/", new(Query8Action))
  179. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  180. if err != nil {
  181. t.Error(err)
  182. }
  183. o.ServeHTTP(recorder, req)
  184. expect(t, recorder.Code, http.StatusOK)
  185. refute(t, len(buff.String()), 0)
  186. expect(t, buff.String(), "1.00")
  187. }
  188. type Query9Action struct {
  189. Ctx
  190. }
  191. func (a *Query9Action) Get() string {
  192. v, _ := a.Queries().Bool("test")
  193. return fmt.Sprintf("%v", v)
  194. }
  195. func TestQuery9(t *testing.T) {
  196. buff := bytes.NewBufferString("")
  197. recorder := httptest.NewRecorder()
  198. recorder.Body = buff
  199. o := Classic()
  200. o.Get("/", new(Query9Action))
  201. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  202. if err != nil {
  203. t.Error(err)
  204. }
  205. o.ServeHTTP(recorder, req)
  206. expect(t, recorder.Code, http.StatusOK)
  207. refute(t, len(buff.String()), 0)
  208. expect(t, buff.String(), "true")
  209. }
  210. type Query10Action struct {
  211. Ctx
  212. }
  213. func (a *Query10Action) Get() string {
  214. v, _ := a.Queries().String("test")
  215. return fmt.Sprintf("%v", v)
  216. }
  217. func TestQuery10(t *testing.T) {
  218. buff := bytes.NewBufferString("")
  219. recorder := httptest.NewRecorder()
  220. recorder.Body = buff
  221. o := Classic()
  222. o.Get("/", new(Query10Action))
  223. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  224. if err != nil {
  225. t.Error(err)
  226. }
  227. o.ServeHTTP(recorder, req)
  228. expect(t, recorder.Code, http.StatusOK)
  229. refute(t, len(buff.String()), 0)
  230. expect(t, buff.String(), "1")
  231. }
  232. type Query11Action struct {
  233. Ctx
  234. }
  235. func (a *Query11Action) Get() string {
  236. v := a.Queries().MustInt("test")
  237. return fmt.Sprintf("%d", v)
  238. }
  239. func TestQuery11(t *testing.T) {
  240. buff := bytes.NewBufferString("")
  241. recorder := httptest.NewRecorder()
  242. recorder.Body = buff
  243. o := Classic()
  244. o.Get("/", new(Query11Action))
  245. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  246. if err != nil {
  247. t.Error(err)
  248. }
  249. o.ServeHTTP(recorder, req)
  250. expect(t, recorder.Code, http.StatusOK)
  251. refute(t, len(buff.String()), 0)
  252. expect(t, buff.String(), "1")
  253. }
  254. type Query12Action struct {
  255. Ctx
  256. }
  257. func (a *Query12Action) Get() string {
  258. v := a.Queries().MustInt32("test")
  259. return fmt.Sprintf("%d", v)
  260. }
  261. func TestQuery12(t *testing.T) {
  262. buff := bytes.NewBufferString("")
  263. recorder := httptest.NewRecorder()
  264. recorder.Body = buff
  265. o := Classic()
  266. o.Get("/", new(Query12Action))
  267. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  268. if err != nil {
  269. t.Error(err)
  270. }
  271. o.ServeHTTP(recorder, req)
  272. expect(t, recorder.Code, http.StatusOK)
  273. refute(t, len(buff.String()), 0)
  274. expect(t, buff.String(), "1")
  275. }
  276. type Query13Action struct {
  277. Ctx
  278. }
  279. func (a *Query13Action) Get() string {
  280. v := a.Queries().MustInt64("test")
  281. return fmt.Sprintf("%d", v)
  282. }
  283. func TestQuery13(t *testing.T) {
  284. buff := bytes.NewBufferString("")
  285. recorder := httptest.NewRecorder()
  286. recorder.Body = buff
  287. o := Classic()
  288. o.Get("/", new(Query13Action))
  289. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  290. if err != nil {
  291. t.Error(err)
  292. }
  293. o.ServeHTTP(recorder, req)
  294. expect(t, recorder.Code, http.StatusOK)
  295. refute(t, len(buff.String()), 0)
  296. expect(t, buff.String(), "1")
  297. }
  298. type Query14Action struct {
  299. Ctx
  300. }
  301. func (a *Query14Action) Get() string {
  302. v := a.Queries().MustUint("test")
  303. return fmt.Sprintf("%d", v)
  304. }
  305. func TestQuery14(t *testing.T) {
  306. buff := bytes.NewBufferString("")
  307. recorder := httptest.NewRecorder()
  308. recorder.Body = buff
  309. o := Classic()
  310. o.Get("/", new(Query14Action))
  311. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  312. if err != nil {
  313. t.Error(err)
  314. }
  315. o.ServeHTTP(recorder, req)
  316. expect(t, recorder.Code, http.StatusOK)
  317. refute(t, len(buff.String()), 0)
  318. expect(t, buff.String(), "1")
  319. }
  320. type Query15Action struct {
  321. Ctx
  322. }
  323. func (a *Query15Action) Get() string {
  324. v := a.Queries().MustUint32("test")
  325. return fmt.Sprintf("%d", v)
  326. }
  327. func TestQuery15(t *testing.T) {
  328. buff := bytes.NewBufferString("")
  329. recorder := httptest.NewRecorder()
  330. recorder.Body = buff
  331. o := Classic()
  332. o.Get("/", new(Query15Action))
  333. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  334. if err != nil {
  335. t.Error(err)
  336. }
  337. o.ServeHTTP(recorder, req)
  338. expect(t, recorder.Code, http.StatusOK)
  339. refute(t, len(buff.String()), 0)
  340. expect(t, buff.String(), "1")
  341. }
  342. type Query16Action struct {
  343. Ctx
  344. }
  345. func (a *Query16Action) Get() string {
  346. v := a.Queries().MustUint64("test")
  347. return fmt.Sprintf("%d", v)
  348. }
  349. func TestQuery16(t *testing.T) {
  350. buff := bytes.NewBufferString("")
  351. recorder := httptest.NewRecorder()
  352. recorder.Body = buff
  353. o := Classic()
  354. o.Get("/", new(Query16Action))
  355. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  356. if err != nil {
  357. t.Error(err)
  358. }
  359. o.ServeHTTP(recorder, req)
  360. expect(t, recorder.Code, http.StatusOK)
  361. refute(t, len(buff.String()), 0)
  362. expect(t, buff.String(), "1")
  363. }
  364. type Query17Action struct {
  365. Ctx
  366. }
  367. func (a *Query17Action) Get() string {
  368. v := a.Queries().MustFloat32("test")
  369. return fmt.Sprintf("%.2f", v)
  370. }
  371. func TestQuery17(t *testing.T) {
  372. buff := bytes.NewBufferString("")
  373. recorder := httptest.NewRecorder()
  374. recorder.Body = buff
  375. o := Classic()
  376. o.Get("/", new(Query17Action))
  377. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  378. if err != nil {
  379. t.Error(err)
  380. }
  381. o.ServeHTTP(recorder, req)
  382. expect(t, recorder.Code, http.StatusOK)
  383. refute(t, len(buff.String()), 0)
  384. expect(t, buff.String(), "1.00")
  385. }
  386. type Query18Action struct {
  387. Ctx
  388. }
  389. func (a *Query18Action) Get() string {
  390. v := a.Queries().MustFloat64("test")
  391. return fmt.Sprintf("%.2f", v)
  392. }
  393. func TestQuery18(t *testing.T) {
  394. buff := bytes.NewBufferString("")
  395. recorder := httptest.NewRecorder()
  396. recorder.Body = buff
  397. o := Classic()
  398. o.Get("/", new(Query18Action))
  399. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  400. if err != nil {
  401. t.Error(err)
  402. }
  403. o.ServeHTTP(recorder, req)
  404. expect(t, recorder.Code, http.StatusOK)
  405. refute(t, len(buff.String()), 0)
  406. expect(t, buff.String(), "1.00")
  407. }
  408. type Query19Action struct {
  409. Ctx
  410. }
  411. func (a *Query19Action) Get() string {
  412. v := a.Queries().MustBool("test")
  413. return fmt.Sprintf("%v", v)
  414. }
  415. func TestQuery19(t *testing.T) {
  416. buff := bytes.NewBufferString("")
  417. recorder := httptest.NewRecorder()
  418. recorder.Body = buff
  419. o := Classic()
  420. o.Get("/", new(Query19Action))
  421. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  422. if err != nil {
  423. t.Error(err)
  424. }
  425. o.ServeHTTP(recorder, req)
  426. expect(t, recorder.Code, http.StatusOK)
  427. refute(t, len(buff.String()), 0)
  428. expect(t, buff.String(), "true")
  429. }
  430. type Query20Action struct {
  431. Ctx
  432. }
  433. func (a *Query20Action) Get() string {
  434. v := a.Queries().MustString("test")
  435. return fmt.Sprintf("%s", v)
  436. }
  437. func TestQuery20(t *testing.T) {
  438. buff := bytes.NewBufferString("")
  439. recorder := httptest.NewRecorder()
  440. recorder.Body = buff
  441. o := Classic()
  442. o.Get("/", new(Query20Action))
  443. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  444. if err != nil {
  445. t.Error(err)
  446. }
  447. o.ServeHTTP(recorder, req)
  448. expect(t, recorder.Code, http.StatusOK)
  449. refute(t, len(buff.String()), 0)
  450. expect(t, buff.String(), "1")
  451. }
  452. type Query21Action struct {
  453. Ctx
  454. }
  455. func (a *Query21Action) Get() string {
  456. v := a.QueryInt("test")
  457. return fmt.Sprintf("%d", v)
  458. }
  459. func TestQuery21(t *testing.T) {
  460. buff := bytes.NewBufferString("")
  461. recorder := httptest.NewRecorder()
  462. recorder.Body = buff
  463. o := Classic()
  464. o.Get("/", new(Query21Action))
  465. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  466. if err != nil {
  467. t.Error(err)
  468. }
  469. o.ServeHTTP(recorder, req)
  470. expect(t, recorder.Code, http.StatusOK)
  471. refute(t, len(buff.String()), 0)
  472. expect(t, buff.String(), "1")
  473. }
  474. type Query22Action struct {
  475. Ctx
  476. }
  477. func (a *Query22Action) Get() string {
  478. v := a.QueryInt32("test")
  479. return fmt.Sprintf("%d", v)
  480. }
  481. func TestQuery22(t *testing.T) {
  482. buff := bytes.NewBufferString("")
  483. recorder := httptest.NewRecorder()
  484. recorder.Body = buff
  485. o := Classic()
  486. o.Get("/", new(Query22Action))
  487. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  488. if err != nil {
  489. t.Error(err)
  490. }
  491. o.ServeHTTP(recorder, req)
  492. expect(t, recorder.Code, http.StatusOK)
  493. refute(t, len(buff.String()), 0)
  494. expect(t, buff.String(), "1")
  495. }
  496. type Query23Action struct {
  497. Ctx
  498. }
  499. func (a *Query23Action) Get() string {
  500. v := a.QueryInt64("test")
  501. return fmt.Sprintf("%d", v)
  502. }
  503. func TestQuery23(t *testing.T) {
  504. buff := bytes.NewBufferString("")
  505. recorder := httptest.NewRecorder()
  506. recorder.Body = buff
  507. o := Classic()
  508. o.Get("/", new(Query23Action))
  509. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  510. if err != nil {
  511. t.Error(err)
  512. }
  513. o.ServeHTTP(recorder, req)
  514. expect(t, recorder.Code, http.StatusOK)
  515. refute(t, len(buff.String()), 0)
  516. expect(t, buff.String(), "1")
  517. }
  518. type Query24Action struct {
  519. Ctx
  520. }
  521. func (a *Query24Action) Get() string {
  522. v := a.QueryUint("test")
  523. return fmt.Sprintf("%d", v)
  524. }
  525. func TestQuery24(t *testing.T) {
  526. buff := bytes.NewBufferString("")
  527. recorder := httptest.NewRecorder()
  528. recorder.Body = buff
  529. o := Classic()
  530. o.Get("/", new(Query24Action))
  531. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  532. if err != nil {
  533. t.Error(err)
  534. }
  535. o.ServeHTTP(recorder, req)
  536. expect(t, recorder.Code, http.StatusOK)
  537. refute(t, len(buff.String()), 0)
  538. expect(t, buff.String(), "1")
  539. }
  540. type Query25Action struct {
  541. Ctx
  542. }
  543. func (a *Query25Action) Get() string {
  544. v := a.QueryUint32("test")
  545. return fmt.Sprintf("%d", v)
  546. }
  547. func TestQuery25(t *testing.T) {
  548. buff := bytes.NewBufferString("")
  549. recorder := httptest.NewRecorder()
  550. recorder.Body = buff
  551. o := Classic()
  552. o.Get("/", new(Query25Action))
  553. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  554. if err != nil {
  555. t.Error(err)
  556. }
  557. o.ServeHTTP(recorder, req)
  558. expect(t, recorder.Code, http.StatusOK)
  559. refute(t, len(buff.String()), 0)
  560. expect(t, buff.String(), "1")
  561. }
  562. type Query26Action struct {
  563. Ctx
  564. }
  565. func (a *Query26Action) Get() string {
  566. v := a.QueryUint64("test")
  567. return fmt.Sprintf("%d", v)
  568. }
  569. func TestQuery26(t *testing.T) {
  570. buff := bytes.NewBufferString("")
  571. recorder := httptest.NewRecorder()
  572. recorder.Body = buff
  573. o := Classic()
  574. o.Get("/", new(Query26Action))
  575. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  576. if err != nil {
  577. t.Error(err)
  578. }
  579. o.ServeHTTP(recorder, req)
  580. expect(t, recorder.Code, http.StatusOK)
  581. refute(t, len(buff.String()), 0)
  582. expect(t, buff.String(), "1")
  583. }
  584. type Query27Action struct {
  585. Ctx
  586. }
  587. func (a *Query27Action) Get() string {
  588. v := a.QueryFloat32("test")
  589. return fmt.Sprintf("%.2f", v)
  590. }
  591. func TestQuery27(t *testing.T) {
  592. buff := bytes.NewBufferString("")
  593. recorder := httptest.NewRecorder()
  594. recorder.Body = buff
  595. o := Classic()
  596. o.Get("/", new(Query27Action))
  597. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  598. if err != nil {
  599. t.Error(err)
  600. }
  601. o.ServeHTTP(recorder, req)
  602. expect(t, recorder.Code, http.StatusOK)
  603. refute(t, len(buff.String()), 0)
  604. expect(t, buff.String(), "1.00")
  605. }
  606. type Query28Action struct {
  607. Ctx
  608. }
  609. func (a *Query28Action) Get() string {
  610. v := a.QueryFloat64("test")
  611. return fmt.Sprintf("%.2f", v)
  612. }
  613. func TestQuery28(t *testing.T) {
  614. buff := bytes.NewBufferString("")
  615. recorder := httptest.NewRecorder()
  616. recorder.Body = buff
  617. o := Classic()
  618. o.Get("/", new(Query28Action))
  619. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  620. if err != nil {
  621. t.Error(err)
  622. }
  623. o.ServeHTTP(recorder, req)
  624. expect(t, recorder.Code, http.StatusOK)
  625. refute(t, len(buff.String()), 0)
  626. expect(t, buff.String(), "1.00")
  627. }
  628. type Query29Action struct {
  629. Ctx
  630. }
  631. func (a *Query29Action) Get() string {
  632. v := a.QueryBool("test")
  633. return fmt.Sprintf("%v", v)
  634. }
  635. func TestQuery29(t *testing.T) {
  636. buff := bytes.NewBufferString("")
  637. recorder := httptest.NewRecorder()
  638. recorder.Body = buff
  639. o := Classic()
  640. o.Get("/", new(Query29Action))
  641. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  642. if err != nil {
  643. t.Error(err)
  644. }
  645. o.ServeHTTP(recorder, req)
  646. expect(t, recorder.Code, http.StatusOK)
  647. refute(t, len(buff.String()), 0)
  648. expect(t, buff.String(), "true")
  649. }
  650. type Query30Action struct {
  651. Ctx
  652. }
  653. func (a *Query30Action) Get() string {
  654. v := a.Query("test")
  655. return fmt.Sprintf("%s", v)
  656. }
  657. func TestQuery30(t *testing.T) {
  658. buff := bytes.NewBufferString("")
  659. recorder := httptest.NewRecorder()
  660. recorder.Body = buff
  661. o := Classic()
  662. o.Get("/", new(Query30Action))
  663. req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
  664. if err != nil {
  665. t.Error(err)
  666. }
  667. o.ServeHTTP(recorder, req)
  668. expect(t, recorder.Code, http.StatusOK)
  669. refute(t, len(buff.String()), 0)
  670. expect(t, buff.String(), "1")
  671. }