我正在使用wiremock standlaone 服务来模拟几个json 对象。实际上我想模拟一个 pdf 文件:只需将我的 pdf 添加到 __files 文件夹,它就可以在我的本地正常工作
但是,我正在尝试使用 POSTMAN(或 curl)将 pdf 推送到服务器上,但这不起作用:
这是我的卷曲:
curl -X PUT https://wiremock-mock.myserver.com/__admin/files/Hello_World.pdf
-H 'Accept: */*'-H 'content-type: multipart/form-data'
-F pdf=@///usr/Perso/Downloads/Hello_World.pdf
我收到此错误:
HTTP ERROR 500
Problem accessing /api/test/fichiers/111111. Reason:
Server Error
Caused by:
wiremock.com.github.jknack.handlebars.HandlebarsException: inline@7adccef6:30:88: found: '?'
#???8FV?c?M8?+?J-P??????????GY???(|?6M:#????w]t???2?P?o?si????2??u?yD]F??$p?
?a????{{z???Z????q????5D&????j}??
??i?s??????{*?r?)5??ee???gzZ?-??kh?'??``Av?2?????(?????Q[????>yYn??iy???vj?f2O?u???gK_???@?7!?c??WF?Y??3$?u ?tT?k)???>??YE???0eX|?V?>?n?-????=?>??j?vB??;?????}2??e?mS?c?D?az??,^?ahV???^??G??R?????\??2?oTjD???G???3??|??9????vnz???&????????M??~?b???????????0???i[v?]?e?"????_????H1m??I?~à;?=???K?.????Ws???? c[?zW9?????]?E:,???????[?^?:????=?????9??V?DF??8?C??+"g$????J??\?nJ?
?Q??n?/?y?????NY?|??????L??3{??c??`C??????N??l??e?????-A??r?4??%???~i?-?????????9ZT!K?i?6)5R???1.????4??6????? B?k2Z????P?6!$??????GFQ????ur?(??(??G?z???d??(????*???J??U??
?R"?b??I?Q?@?? mt??2d??= ????\?6??kO
^
at wiremock.com.github.jknack.handlebars.internal.HbsErrorReporter.syntaxError(HbsErrorReporter.java:93)
at wiremock.org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
at wiremock.com.github.jknack.handlebars.internal.HbsParserFactory$2.notifyListeners(HbsParserFactory.java:148)
at wiremock.org.antlr.v4.runtime.Lexer.nextToken(Lexer.java:144)
at wiremock.org.antlr.v4.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:169)
at wiremock.org.antlr.v4.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:152)
at wiremock.org.antlr.v4.runtime.BufferedTokenStream.consume(BufferedTokenStream.java:136)
at wiremock.org.antlr.v4.runtime.Parser.consume(Parser.java:571)
at wiremock.org.antlr.v4.runtime.Parser.match(Parser.java:203)
at wiremock.com.github.jknack.handlebars.internal.HbsParser.sexpr(HbsParser.java:887)
at wiremock.com.github.jknack.handlebars.internal.HbsParser.var(HbsParser.java:1381)
at wiremock.com.github.jknack.handlebars.internal.HbsParser.statement(HbsParser.java:344)
at wiremock.com.github.jknack.handlebars.internal.HbsParser.body(HbsParser.java:222)
at wiremock.com.github.jknack.handlebars.internal.HbsParser.template(HbsParser.java:165)
at wiremock.com.github.jknack.handlebars.internal.HbsParserFactory$1.parse(HbsParserFactory.java:84)
at wiremock.com.github.jknack.handlebars.cache.NullTemplateCache.get(NullTemplateCache.java:54)
at wiremock.com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:475)
at wiremock.com.github.jknack.handlebars.Handlebars.compileInline(Handlebars.java:435)
at wiremock.com.github.jknack.handlebars.Handlebars.compileInline(Handlebars.java:415)
at com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer.uncheckedCompileTemplate(ResponseTemplateTransformer.java:168)
at com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer.transform(ResponseTemplateTransformer.java:122)
at com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings.applyTransformations(InMemoryStubMappings.java:91)
at com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings.serveFor(InMemoryStubMappings.java:72)
at com.github.tomakehurst.wiremock.core.WireMockApp.serveStubFor(WireMockApp.java:167)
at com.github.tomakehurst.wiremock.http.StubRequestHandler.handleRequest(StubRequestHandler.java:50)
at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:47)
at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at wiremock.org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at wiremock.org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at wiremock.org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at wiremock.org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at wiremock.org.eclipse.jetty.servlets.gzip.GzipHandler.handle(GzipHandler.java:479)
at wiremock.org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at wiremock.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at wiremock.org.eclipse.jetty.server.Server.handle(Server.java:499)
at wiremock.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at wiremock.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
at wiremock.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
如何在wiremock服务器上推送pdf文件?