Netflix/dgs-examples-java

line break issue

littlelouishu opened this issue · 0 comments

Request failed when some value has the line break like \n in it.

It's a bug, or my code missing necessary escape porcess?

I tried escape the \n to \\n in json value. But ther sever side treated the \\n to \n as string instead of line breaker. It's server side's fault?

client.reactiveExecuteQuery(queryRequest.serialize())
client is a instance of [WebClientGraphQLClient]

com.netflix.graphql.dgs.client.GraphQLClientException: 400 BAD_REQUEST "GraphQL server org.springframework.web.reactive.function.client.DefaultWebClient@59d42d75 responded with status code 400: '{"errors":[{"message":"Syntax Error: Unterminated string.","locations":[{"line":1,"column":107}],"extensions":{"code":"GRAPHQL_PARSE_FAILED"}}]} '. The request sent to the server was {"query":"mutation {createProduct(input: {categoryId:\"puaRCidQs8nVVNcXWbpgoZ\", condition:BRAND_NEW, description:\"サイズ\nS ( 身幅:60cm 着丈:119cm 肩幅:45cm 袖丈:66cm) M ( 身幅:62cm 着丈:120cm 肩幅:46cm 袖丈:67cm) L ( 身幅:64cm 着丈:121cm 肩幅:47cm 袖丈:68cm) XL ( 身幅:66cm 着丈:122cm 肩幅:48cm 袖丈:69cm) XXL ( 身幅:68cm 着丈:123cm 肩幅:49cm 袖丈:70cm)\n素材\n表地:ポリエステル100% 裏地:ポリエステル100% 中わた:ポリエステル100% その他:ポリエステル87%、ポリウレタン13%\n生産国\nベトナム\n\", imageUrls:[\"https://stc.milleporte.com/EVENTS/221105UNDE/web/960/4580637165083_1.jpg\", \"https://stc.milleporte.com/EVENTS/221105UNDE/web/960/4580637165083_2.jpg\"], name:\"UA LONG COAT WORD LOGO ブラック\", price:10460, shippingDuration:FOUR_TO_SEVEN_DAYS, shippingFromStateId:\"jp11\", shippingMethod:UNDECIDED, shippingPayer:SELLER, status:OPENED, variants:[{janCode:\"\", name:\"XL\", skuCode:\"16830662\", stockQuantity:1 }] }){ product { id variants { skuCode id } } } }","variables":{},"operationName":null}"