@@ -123,6 +123,33 @@ func Test_repositoryResourceContents(t *testing.T) {
123123 URI : "" ,
124124 }}},
125125 },
126+ {
127+ name : "successful text content fetch (HEAD)" ,
128+ mockedClient : mock .NewMockedHTTPClient (
129+ mock .WithRequestMatchHandler (
130+ raw .GetRawReposContentsByOwnerByRepoByPath ,
131+ http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
132+ w .Header ().Set ("Content-Type" , "text/plain" )
133+
134+ require .Contains (t , r .URL .Path , "pkg/github/actions.go" )
135+ _ , err := w .Write ([]byte ("package actions\n \n func main() {\n // Sample Go file content\n }\n " ))
136+ require .NoError (t , err )
137+ }),
138+ ),
139+ ),
140+ uri : "repo://owner/repo/contents/pkg/github/actions.go" ,
141+ handlerFn : func (getClient GetClientFn , getRawClient raw.GetRawClientFn , t translations.TranslationHelperFunc ) mcp.ResourceHandler {
142+ _ , handler := GetRepositoryResourceContent (getClient , getRawClient , t )
143+ return handler
144+ },
145+ expectedResponseType : resourceResponseTypeText ,
146+ expectedResult : & mcp.ReadResourceResult {
147+ Contents : []* mcp.ResourceContents {{
148+ Text : "package actions\n \n func main() {\n // Sample Go file content\n }\n " ,
149+ MIMEType : "text/plain" ,
150+ URI : "" ,
151+ }}},
152+ },
126153 {
127154 name : "successful text content fetch (branch)" ,
128155 mockedClient : mock .NewMockedHTTPClient (
0 commit comments