rawDocWithAttachmentAndSyncMeta returns a raw document with an attachment and sync metadata inline. RestTester is used to determine the sequence for the document.
(rt *RestTester)
| 2712 | |
| 2713 | // rawDocWithAttachmentAndSyncMeta returns a raw document with an attachment and sync metadata inline. RestTester is used to determine the sequence for the document. |
| 2714 | func rawDocWithAttachmentAndSyncMeta(rt *RestTester) []byte { |
| 2715 | latestSeq, err := rt.GetDatabase().NextSequence(rt.Context()) |
| 2716 | require.NoError(rt.TB(), err) |
| 2717 | return []byte(fmt.Sprintf(`{ |
| 2718 | "_sync": { |
| 2719 | "rev": "1-5fc93bd36377008f96fdae2719c174ed", |
| 2720 | "sequence": %d, |
| 2721 | "recent_sequences": [ |
| 2722 | %d |
| 2723 | ], |
| 2724 | "history": { |
| 2725 | "revs": [ |
| 2726 | "1-5fc93bd36377008f96fdae2719c174ed" |
| 2727 | ], |
| 2728 | "parents": [ |
| 2729 | -1 |
| 2730 | ], |
| 2731 | "channels": [ |
| 2732 | null |
| 2733 | ] |
| 2734 | }, |
| 2735 | "cas": "", |
| 2736 | "attachments": { |
| 2737 | "hi.txt": { |
| 2738 | "revpos": 1, |
| 2739 | "content_type": "text/plain", |
| 2740 | "length": 2, |
| 2741 | "stub": true, |
| 2742 | "digest": "sha1-witfkXg0JglCjW9RssWvTAveakI=" |
| 2743 | } |
| 2744 | }, |
| 2745 | "time_saved": "2021-09-01T17:33:03.054227821Z" |
| 2746 | }, |
| 2747 | "key": "value" |
| 2748 | }`, latestSeq, latestSeq)) |
| 2749 | } |
| 2750 | |
| 2751 | // attachmentHeaders returns the headers needed to store an attachment. |
| 2752 | func attachmentHeaders() map[string]string { |
no test coverage detected