"use strict";(self.webpackChunkgrpc_workshop_doc=self.webpackChunkgrpc_workshop_doc||[]).push([[1353],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=s(n),g=o,m=p["".concat(c,".").concat(g)]||p[g]||f[g]||i;return n?r.createElement(m,a(a({ref:t},u),{},{components:n})):r.createElement(m,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=g;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[p]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<i;s++)a[s]=n[s];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}g.displayName="MDXCreateElement"},9756:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(7462),o=(n(7294),n(3905));const i={},a="Testing in Postman",l={unversionedId:"Day 1/Documenting gRPC/enabling-reflection",id:"Day 1/Documenting gRPC/enabling-reflection",title:"Testing in Postman",description:"When it comes to testing our gRPC service the first option we would want, is a visual one, using a tool of sort. There are plenty of options out there but Postman is the go to one, for me.",source:"@site/docs/Day 1/06-Documenting gRPC/enabling-reflection.md",sourceDirName:"Day 1/06-Documenting gRPC",slug:"/Day 1/Documenting gRPC/enabling-reflection",permalink:"/docs/Day 1/Documenting gRPC/enabling-reflection",draft:!1,editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/docs/Day 1/06-Documenting gRPC/enabling-reflection.md",tags:[],version:"current",frontMatter:{},sidebar:"day1",previous:{title:"Documenting gRPC & Testing",permalink:"/docs/Day 1/Documenting gRPC/"},next:{title:"Transient-fault handling",permalink:"/docs/Day 1/Transient fault-handling/"}},c={},s=[],u={toc:s},p="wrapper";function f(e){let{components:t,...n}=e;return(0,o.kt)(p,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"testing-in-postman"},"Testing in Postman"),(0,o.kt)("p",null,"When it comes to testing our gRPC service the first option we would want, is a visual one, using a tool of sort. There are plenty of options out there but Postman is the go to one, for me.\nIt allow us to:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"load our proto files and issue gRPC request to the sever."),(0,o.kt)("li",{parentName:"ul"},"discover the operations with Server reflection")),(0,o.kt)("h1",{id:"enabling-reflection"},"Enabling reflection"),(0,o.kt)("p",null,"This will allow operation discovery from Postman or any other tool that will require it"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install ",(0,o.kt)("inlineCode",{parentName:"li"},"Grpc.AspNetCore.Server.Reflection")," package")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-csharp"},"builder.Services.AddGrpcReflection();\n\n/// after service mapping\nIWebHostEnvironment env = app.Environment;\n\nif (env.IsDevelopment())\n{\n   app.MapGrpcReflectionService();\n}\n")),(0,o.kt)("h1",{id:"practice"},"Practice"))}f.isMDXComponent=!0}}]);